尝试构建一个简单的系统,如果 Last 交易高于前一小时的高点,则买入看涨期权,或者如果 Last 的交易低于前一小时的低点,则买入看跌期权。并且当新的入场发生时,自动追踪止损被放置在期权价值的一半处。理想情况下寻找下一个资金选项。
目前,这就是我所拥有的股票代码:
@Override
public void nextValidId(int orderId) {
System.out.println("id "+orderId);
nextOrderID = orderId;
//contract.m_localSymbol = "ESM7";
Contract c = new Contract ();
//contract.m_localSymbol = "ESM7";
c.m_symbol = "SPY";
c.m_exchange = "SMART";
c.m_secType = "STK";
c.m_currency = "USD";
m_s.reqHistoricalData(1, c,
LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE)+ " 16:00:00",
"2 D", "1 day", "MIDPOINT", 1, 1, null);
m_s.reqMktData(1, c, "", false, null);
Order order = new Order();
order.m_action = "BUY";
order.m_totalQuantity = 1;
order.m_lmtPrice = 4.00;
order.m_orderType = "LMT";
order.m_account = "11231231";
Contract contract = new Contract();
contract.Symbol = "SPY";
contract.SecType = "OPT";
contract.Exchange = "BOX";
contract.Currency = "USD";
contract.LastTradeDateOrContractMonth =
到期应罢工应自动进入下一个到期合同
contract.Strike =
应自动输入罢工
contract.Right =
权利(看涨/看跌)应自动输入
contract.Multiplier = "100";
}
我不知道如何接受这个并下订单。