Skip to content
All library documents

Querying Available Funds and Margin in a VeighNa Account

Article vn.py community

Summary

This forum post presents a question about why a simulated account with other positions does not show margin as expected. It includes a long VeighNa CTA strategy example that attempts to find a USD account, read account balance and available funds, and derive occupied margin from several possible account fields. It logs account details and synchronizes account data after trades, while also containing moving-average entry logic and position controls.

The post does not include a response or establish the cause of the missing margin value, so it is not a confirmed guide to the platform's account interface. Its field-priority assumptions and account-ID matching logic are specific to the supplied code and may not match a broker adapter's actual data model. The example does illustrate that balance, tradable funds, and initial margin are distinct values and that inspecting returned account fields can help diagnose a mapping problem. It provides no validation results or API documentation to confirm those mappings.

Key ideas

  • The question concerns missing margin information in a simulated account that has other positions.
  • The example searches account records and attempts to map balance, available funds, and margin from alternative fields.
  • The strategy logs account data and refreshes it after trades, alongside its trading logic.
  • The post gives no answer to the original question and does not validate the field mappings.
  • Broker adapters and account schemas may require different account identifiers and margin fields.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.