public String 成交回报() { try { Spi ctpTradeSpi = userSession.getTradeSpi(); Pointer<CThostFtdcTradeField> pTrade = getTradeField(); ctpTradeSpi.OnRtnTrade(pTrade); return FitResult.success(); } catch (Exception e) { return FitResult.fail(e); } }
public String 创建() { ExecutionFillCreateEvent executionFillCreateEvent = new ExecutionFillCreateEvent(); executionFillCreateEvent.setExecutionId(执行Id); executionFillCreateEvent.setExecutionIndex(1); executionFillCreateEvent.setInternalSecurityId(证券系统内部代码); executionFillCreateEvent.setReportType(InputConvert.getId(回报类型Id)); executionFillCreateEvent.setFillPrice(InputConvert.getNumber(成交价格)); executionFillCreateEvent.setFillQty(InputConvert.getNumber(成交数量)); executionFillCreateEvent.setReason(错误原因代码); executionFillCreateEvent.setErrorMessage(错误原因信息); fillCreateService.CreateExecutionFill(executionFillCreateEvent); return FitResult.success(); }
public String 添加合约() { Map<String, String> contract = new HashMap<String, String>(); contract.put("open_date", 合约开仓日期); contract.put("compact_id", 合约编号); contract.put("fund_account", 资金账号); contract.put("stock_code", 证券代码); contract.put("entrust_no", 委托编号); contract.put("entrust_price", 委托价格); contract.put("entrust_amount", 委托数量); contract.put("business_amount", 合约开仓数量); contract.put("business_balance", 合约开仓金额); contract.put("compact_status", 合约状态); contract.put("ret_end_date", 归还截止日); contract.put("compact_interest", 合约总利息); contractHolder.addContract(contract); return FitResult.success(); }
public String 提示() throws ParseException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd-HH:mm:ss"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); final Date current = simpleDateFormat.parse(当前时间); SystemTime.setTimeSource( new TimeSource() { @Override public long millis() { return current.getTime(); } }); Date start = simpleDateFormat.parse(开始时间); Date end = simpleDateFormat.parse("20130201-07:00:00"); AlgoPlacementTimeValidate algoPlacementTimeValidate = new AlgoPlacementTimeValidate(); try { algoPlacementTimeValidate.validate(start, end); return FitResult.success(); } catch (AlgoPlacementException e) { return e.getMessage(); } }