public static string getStockTradeTypeStr(OkexStockTradeType tt) { string str = ""; switch (tt) { case OkexStockTradeType.STT_Buy: str = "buy"; break; case OkexStockTradeType.STT_Sell: str = "sell"; break; case OkexStockTradeType.STT_BuyMarketPrice: str = "buy_market"; break; case OkexStockTradeType.STT_SellMarketPrice: str = "sell_market"; break; default: break; } return(str); }
public void trade(OkexCoinType comm, OkexCoinType curr, double price, double volume, OkexStockTradeType type, StockTradeEntity.StockTradeEventHandler callback = null, long queryInterval = 1000) { StockTradeEntity entity = new StockTradeEntity(comm, curr, queryInterval); entity.setTradeEventHandler(callback); OkexStockTrader.Instance.tradeAsync(comm, curr, type, price, volume, entity.onAsyncCallback); m_stockEntityList.Add(entity); }
public void tradeAsync(OkexCoinType commodity, OkexCoinType currency, OkexStockTradeType tradeType, double price, double amount, HttpAsyncReq.ResponseCallback callback) { string c0 = OkexDefValueConvert.getCoinName(commodity); string c1 = OkexDefValueConvert.getCoinName(currency); string symbol = c0 + "_" + c1; string strType = OkexDefValueConvert.getStockTradeTypeStr(tradeType); postRequest.tradeAsync(symbol, strType, price.ToString(), amount.ToString(), callback); }