def __init__(self, default_position, undercut_market_by=0.01, minimum_return=1.005, market_fee=0.005):
'''
default_position is whether the Strategy should hold the minor currency (sell, False) or
the major currency (buy / True) after scalping the market. For example, in a USD-CAD market
True would mean CAD is held after scalping and False would mean USD is held after scalping.
It is assumed that the default_position is currently being held. If not, override it by setting
current_position after initializing the strategy.
'''
Strategy.__init__(self)
self._spread_size_indicator = SpreadSize(minimum_return, market_fee)
self.default_position = default_position
self.current_position = default_position
self._first_time_unprofitable = True #Prevents repeating the same message.
# undercut_market_by is used to make the strategy's order be the next one filled on the market.
with localcontext() as context:
context.prec = 8
self.undercut_market_by = Decimal(undercut_market_by)
spread_size_strategy.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录