FutuQuant量化接口的Java版本
API行情接口详细调用例程参见 com.test.TestCase
API交易接口详细调用例程参见 com.test.TraderTestCase
行情api
Session session = FutuOpenD.openSession("localhost", 11111);
//订阅股票
session.qotSub(QotMarket.QotMarket_HK_Security, new String[]{"00700","00005"},new SubType[] {SubType.SubType_Basic,SubType.SubType_Ticker,SubType.SubType_KL_1Min,SubType.SubType_KL_Day,SubType.SubType_RT,SubType.SubType_OrderBook,SubType.SubType_Broker});
//订阅推送
session.qotRegQotPush(QotMarket.QotMarket_HK_Security, new String[]{"00700"}, new SubType[]{SubType.SubType_Basic,SubType.SubType_Ticker,SubType.SubType_KL_1Min,SubType.SubType_KL_Day,SubType.SubType_RT,SubType.SubType_OrderBook,SubType.SubType_Broker});
//分时(含回调)
session.qotGetRT(QotMarket.QotMarket_HK_Security, "00700", new IUpdateCallBack<List<TimeShare>>(){
@Override
public void callback(List<TimeShare> res) {
}
});
session.close();
交易api
Session session = FutuOpenD.openSession("localhost", 11111);
//解锁交易,自动打开交易推送功能
//TraderSession traderSession = session.trdUnlockTradeForReal(this.futuUserID,pwdMD5);//实盘交易
//模拟交易
TraderSession traderSession = session.trdUnlockTradeForSimulate(this.futuUserID,pwdMD5);
//下单
traderSession.trdPlaceOrder(TrdMarket.TrdMarket_HK,TrdSide.TrdSide_Buy,OrderType.OrderType_Normal,"00700",100,200,null,null,null);
session.close();