// K线 public List <OkexKLineData> getKLineData(OkexFutureInstrumentType instrument, OkexFutureContractType contract, OkexKLineType klType) { List <OkexKLineData> kLines = new List <OkexKLineData>(); string str = getRequest.future_kline(OkexDefValueConvert.getInstrumentStr(instrument), OkexDefValueConvert.getKLineTypeStr(klType), OkexDefValueConvert.getContractTypeStr(contract), "", ""); JArray arr = JArray.Parse(str); foreach (var item in arr) { JArray klArr = JArray.Parse(item.ToString()); OkexKLineData kld = new OkexKLineData(); kld.timestamp = (long)klArr[0]; kld.open = (double)klArr[1]; kld.high = (double)klArr[2]; kld.low = (double)klArr[3]; kld.close = (double)klArr[4]; kld.volume = (long)klArr[5]; kld.refValue = (double)klArr[6]; kLines.Add(kld); } return(kLines); }
protected long getPositionByContract(OkexFutureInstrumentType instrument, OkexFutureContractType contract, OkexFutureTradeDirectionType direction) { return(OkexFutureTrader.Instance.getHoldPositionAmount(instrument, contract, direction)); }
public void cancelAsync(OkexFutureInstrumentType instrument, OkexFutureContractType contract, long orderID, HttpAsyncReq.ResponseCallback callback) { postRequest.future_cancel_async(OkexDefValueConvert.getInstrumentStr(instrument), OkexDefValueConvert.getContractTypeStr(contract), orderID.ToString(), callback); }
public static string getCoinName(OkexFutureInstrumentType instrument) { return(coinName[(int)instrument]); }
public static string getInstrumentStr(OkexFutureInstrumentType instrument) { return(instrumentQuotationName[(int)instrument]); }
public MarketDataUpdater(OkexFutureInstrumentType inst, OkexFutureContractType cntr) { m_instrument = inst; m_contract = cntr; }
public void trade(OkexFutureInstrumentType instrument, OkexFutureContractType contract, double price, long volume, OkexContractTradeType type, uint leverRate = 10) { FutureTradeMgr.Instance.trade(this, instrument, contract, price, volume, type, leverRate); }
private int genTargetID(OkexFutureInstrumentType instrument, OkexFutureContractType contract) { return((int)instrument * 10000 + (int)contract); }
public FutureTradeEntity(OkexFutureInstrumentType instrument, OkexFutureContractType contract, long queryInterval = 1000) : base(queryInterval) { m_instrument = instrument; m_contract = contract; }