mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 12:05:54 +08:00
Removes unused constant and redirection of imports.
Removes TRANSFORM_TYPE from protocol, since it is unused. Also, removes use of ndict as a member of protocol, since it's import there was for the TRANSFORM_TYPE. Changed to utils.protocol_utils instead.
This commit is contained in:
@@ -21,7 +21,7 @@ import pytz
|
||||
|
||||
import zipline.utils.factory as factory
|
||||
import zipline.finance.performance as perf
|
||||
import zipline.protocol as zp
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
|
||||
from zipline.finance.trading import TradingEnvironment
|
||||
|
||||
@@ -574,7 +574,7 @@ shares in position"
|
||||
#create a transaction for all but
|
||||
#first trade in each sid, to simulate None transaction
|
||||
if(event.dt != self.trading_environment.period_start):
|
||||
txn = zp.ndict({
|
||||
txn = ndict({
|
||||
'sid': event.sid,
|
||||
'amount': -25,
|
||||
'dt': event.dt,
|
||||
|
||||
@@ -136,6 +136,7 @@ import datetime
|
||||
import pytz
|
||||
import math
|
||||
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
import zipline.protocol as zp
|
||||
import zipline.finance.risk as risk
|
||||
|
||||
@@ -241,7 +242,7 @@ class PerformanceTracker(object):
|
||||
|
||||
message = None
|
||||
|
||||
assert isinstance(event, zp.ndict)
|
||||
assert isinstance(event, ndict)
|
||||
self.event_count += 1
|
||||
|
||||
if(event.dt >= self.market_close):
|
||||
@@ -545,15 +546,15 @@ class PerformancePeriod(object):
|
||||
del(portfolio['max_capital_used'])
|
||||
|
||||
portfolio['positions'] = self.get_positions()
|
||||
return zp.ndict(portfolio)
|
||||
return ndict(portfolio)
|
||||
|
||||
def get_positions(self):
|
||||
|
||||
positions = zp.ndict(internal=position_ndict())
|
||||
positions = ndict(internal=position_ndict())
|
||||
|
||||
for sid, pos in self.positions.iteritems():
|
||||
cur = pos.to_dict()
|
||||
positions[sid] = zp.ndict(cur)
|
||||
positions[sid] = ndict(cur)
|
||||
|
||||
return positions
|
||||
|
||||
@@ -577,5 +578,5 @@ class position_ndict(dict):
|
||||
|
||||
def __missing__(self, key):
|
||||
pos = Position(key)
|
||||
self[key] = zp.ndict(pos.to_dict())
|
||||
self[key] = ndict(pos.to_dict())
|
||||
return pos
|
||||
|
||||
@@ -19,7 +19,7 @@ import math
|
||||
|
||||
from functools import partial
|
||||
|
||||
import zipline.protocol as zp
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
|
||||
|
||||
def transact_stub(slippage, commission, event, open_orders):
|
||||
@@ -48,7 +48,7 @@ def create_transaction(sid, amount, price, dt):
|
||||
'price': price,
|
||||
}
|
||||
|
||||
transaction = zp.ndict(txn)
|
||||
transaction = ndict(txn)
|
||||
return transaction
|
||||
|
||||
|
||||
|
||||
+1
-8
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from utils.protocol_utils import Enum, ndict
|
||||
from utils.protocol_utils import Enum
|
||||
|
||||
# Datasource type should completely determine the other fields of a
|
||||
# message with its type.
|
||||
@@ -27,10 +27,3 @@ DATASOURCE_TYPE = Enum(
|
||||
'EMPTY',
|
||||
'DONE'
|
||||
)
|
||||
|
||||
|
||||
#Transform type needs to be a ndict to facilitate merging.
|
||||
TRANSFORM_TYPE = ndict({
|
||||
'PASSTHROUGH': 'PASSTHROUGH',
|
||||
'EMPTY': ''
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user