Importar json
chart = {
O que é que ele está a fazer?
O que é isso?
PreTime = 0
def main (:
Global chart # lembrado Referências globais
Log (exchange.GetAccount) (em inglês)
exchange.SetContractType (
records = exchange.GetRecords()
while((records is None) or len(records) < 30):
records = exchange.GetRecords()
LogStatus("records.length:", len(records))
Sleep(1000)
ext.PlotRecords(records, 'OK期货');
ext.PlotLine('dif', 0, records[len(records) - 1].Time)
ext.PlotLine('dea', 0, records[len(records) - 1].Time)
chart = ext.PlotLine('macd', 0, records[len(records)- 1].Time)
# 修改指标线 坐标轴Y轴
for key in ChartObj.series:
if(ChartObj.series[key].name == 'dif' or ChartObj.series[key].name == 'dea' or ChartObj.series[key].name == 'macd'):
ChartObj.series[key].yAxis = 1
chart.update(ChartObj)
chart.reset()
while(true):
records = exchange.GetRecords()
if(len(records) > 50):
ext.PlotRecords(records, 'OK期货')
MACD = TA.MACD(records)
dif = MACD[0]
dea = MACD[1]
macd = MACD[2]
if preTime != records[records.length - 1].Time:
ext.PlotLine('dif', dif[dif.length - 2], records[records.length - 2].Time)
ext.PlotLine('dea', dea[dea.length - 2], records[records.length - 2].Time)
ext.PlotLine('macd', macd[macd.length - 2], records[records.length - 2].Time)
ext.PlotLine('dif', dif[dif.length - 1], records[records.length - 1].Time)
ext.PlotLine('dea', dea[dea.length - 1], records[records.length - 1].Time)
ext.PlotLine('macd', macd[macd.length - 1], records[records.length - 1].Time)
preTime = records[records.length - 1].Time
else:
ext.PlotLine('dif', dif[dif.length - 1], records[records.length - 1].Time)
ext.PlotLine('dea', dea[dea.length - 1], records[records.length - 1].Time)
ext.PlotLine('macd', macd[macd.length - 1], records[records.length - 1].Time)
LogStatus("records.length:", records.length, records[records.length - 1])
Sleep(1000)
Ervas daninhasInformações erradas publicadas