Mapping Futures Order States and Diagnosing Missing Contract Data
Summary
This forum thread combines a troubleshooting exchange about a futures gateway with code excerpts for mapping a broker API into VeighNa. The code translates broker order-state values into framework statuses and maps direction, order type, open/close offsets, exchanges, product types, and option types. The discussion points to a practical dependency: contract lookup must return instruments before orders can be submitted, and login or server connection callbacks can help investigate why instrument data is missing.
A user also reports a KeyError when code looks up a currency using a contract symbol, indicating that the symbol-to-currency cache lacks that key. The thread says the issue was resolved but does not record the fix, root cause, or a verified diagnosis. The excerpts are partial and include unimplemented methods, so they are not a complete gateway implementation or a general guide to broker connectivity. The useful lesson is to check login callbacks, contract-query completion, and required mapping caches when diagnosing order failures.
Key ideas
- The gateway translates broker order states and trading attributes into VeighNa framework enums.
- Contract data must be available before an order can be submitted successfully.
- Login callbacks and connection logs can help diagnose missing contract-query results.
- A currency lookup KeyError indicates that the relevant symbol mapping is absent.
- The thread reports resolution but does not provide the fix or a complete implementation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.