-
Notifications
You must be signed in to change notification settings - Fork 8
Entry
RossyWhite edited this page Aug 21, 2017
·
2 revisions
エントリー条件を表現するクラスです。
独自の条件を作成する場合は、このクラスを継承して作成します。
from zaifbot.rules import Entry継承して独自のクラスを作成してください。
class MyEntry(Entry):
def __init__(self, currency_pair, amount, action, name):
super().__init__(self, currency_pair, amount, action, name)
def can_entry(self, *args, **kwargs):
if 'some condition':
return True
return FalseEntryを継承したクラスは、必ずcan_entryメソッドを持たせてください。
そして、can_entryメソッド内では、True, またはFalseを返すようにします。
can_entryがTrueを返す時に、Strategyクラスがエントリーを実行するようになっています。
また、上記のように__init__で親クラスの__init__を呼び出してパラメータをセットしてください。
- currency_pair => 取引対象の通貨ペア
- amount => 取引量
- action =>
'bid(買い)'or'ask'(売り)かのどちらか
です。