随意玩玩,未经严格实盘测试
In [1]:
import OnePy as op
from OnePy.custom_module.oanda_broker import OandaBroker
from OnePy.custom_module.oanda_reader import OandaReader
from OnePy.custom_module.oanda_recorder import OandaRecorder
class SmaStrategy(op.StrategyBase):
def __init__(self):
super().__init__()
def handle_bar(self):
for ticker in self.env.tickers:
self.buy(100, ticker, takeprofit=15, stoploss=100)
TICKER_LIST = ['EUR_USD', "USD_JPY"]
SLIPPAGE = dict(EUR_USD=1.5,
AUD_USD=1.5,
GBP_USD=2.0,
USD_CAD=2.0,
USD_JPY=1.5)
for ticker in TICKER_LIST:
OandaReader(ticker=ticker, log=True)
SmaStrategy()
OandaBroker()
OandaRecorder().set_setting(slippage=SLIPPAGE)
go = op.OnePiece()
go.show_log()
go.set_forex_live_trading('S10')
In [2]:
go.output.show_setting()
In [ ]:
go.sunny()
In [ ]:
In [ ]: