ENH: wrapping up asset min_trade_size for fractional coinsup to 1/100000000th of a coin

This commit is contained in:
Victor Grau Serrat
2017-09-14 15:22:51 -06:00
parent e5a137f205
commit c3897cfa5a
5 changed files with 8 additions and 3 deletions
+3 -1
View File
@@ -73,7 +73,7 @@ _equities_defaults = {
'exchange': None,
# optional, something like "New York Stock Exchange"
'exchange_full': None,
'min_trade_size': None
'min_trade_size': 1
}
# Default values for the futures DataFrame
@@ -391,6 +391,8 @@ class AssetDBWriter(object):
The date on which to close any positions in this asset.
exchange : str
The exchange where this asset is traded.
min_trade_size: float, optional
The minimum denomination this asset can be traded.
The index of this dataframe should contain the sids.
futures : pd.DataFrame, optional
+1
View File
@@ -24,6 +24,7 @@ class BasePricingBundle(BaseBundle):
('start_date', 'datetime64[ns]'),
('end_date', 'datetime64[ns]'),
('ac_date', 'datetime64[ns]'),
('min_trade_size', 'float'),
]
@lazyval
+2
View File
@@ -75,12 +75,14 @@ class PoloniexBundle(BaseCryptoPricingBundle):
start_date = sym_data.index[0]
end_date = sym_data.index[-1]
ac_date = end_date + pd.Timedelta(days=1)
min_trade_size = 0.00000001
return (
sym_md.symbol,
start_date,
end_date,
ac_date,
min_trade_size,
)
def fetch_raw_symbol_frame(self,
+1 -1
View File
@@ -219,7 +219,7 @@ class VolumeShareSlippage(SlippageModel):
# the current order amount will be the min of the
# volume available in the bar or the open amount.
cur_volume = int(min(remaining_volume, abs(order.open_amount)))
cur_volume = min(remaining_volume, abs(order.open_amount))
if cur_volume < min_trade_size:
return None, None
+1 -1
View File
@@ -68,7 +68,7 @@ def create_transaction(order, dt, price, amount):
transaction = Transaction(
asset=order.asset,
amount=amounts,
amount=amount,
dt=dt,
price=price,
order_id=order.id