https://download.csdn.net/download/repay3/16460847
A股 港股 K线数据
https://download.csdn.net/download/repay3/16452858
美股策略回测 rsi kdj sma 美股行情 美股数据 通达信
AAPL 日线策略SMA 5 SMA 10 买卖回测图
AAPL 期权日线和15分钟数据
futu-api 富途程式交易核心代码 + SMA 5 10 策略
def place_(symbol, price, cash, side):
global TRD_ENV
volume = int(cash//price) if side == 'buy' else get_one(symbol)
trd_side = TrdSide.SELL if side == 'sell' else TrdSide.BUY
print(symbol,price,trd_side,volume)
if TRD_ENV==TrdEnv.REAL:
ret,data_err=trd_ctx.place_order(price=0, qty=volume, code=symbol, trd_side=trd_side, order_type=OrderType.MARKET, trd_env=TRD_ENV)
else:
ret,data_err=trd_ctx.place_order(price=price, qty=volume, code=symbol, trd_side=trd_side, trd_env=TRD_ENV)
if ret==-1:
def_txt('place_order '+data_err)
return(ret, data_err)
def ma(df, n):
MA = pd.Series(df['close'].rolling(n, min_periods=n).mean(), name='MA_' + str(n))
df = df.join(MA)
return df
def slist_one(symbol):
data=pd.DataFrame({})
ret=-1
while ret==-1:
time.sleep(3.5)
ret, data = quote_ctx.get_market_snapshot(symbol)
if ret==-1:
def_txt('slist_one -1 ')
return(data)
def five_back(df): # SMA
if len(df)<10:
print(' len < 10 '); return
df = ma(df,5); df = ma(df,10);
print(df.tail(