Best way to send information from broker is use Account Data, examples for strategy:
Code:
private void GetAccountData(byte providerId)
{
AccountDataSnapshot data = this.framework.AccountDataManager.GetSnapshot(providerId, providerId);
if (data != null && data.Entries.Length != 0)
{
Console.WriteLine("AccountDataSnapshot, records count " + data.Entries.Length);
foreach (AccountDataEntry entry in data.Entries)
{
Console.WriteLine("Account:" + entry.Account);
Console.WriteLine("Values Fields Count :" + entry.Values.Fields.Count);
Console.WriteLine("Positions Length:" + entry.Positions.Length);
Console.WriteLine("Orders Length:" + entry.Orders.Length);
}
}
else
Console.WriteLine("AccountDataSnapshot no data");
}
protected override void OnAccountData(SmartQuant.AccountData accountData)
{
string msg = "OnAccountData at "+Instrument+" Account: "+accountData.Account+" fieldsCount: "+ accountData.Fields.Count;
foreach(AccountDataField field in accountData.Fields)
msg += " "+field.Name+" "+field.Value;
Console.WriteLine(msg);
}
for provider side:
Code:
AccountData data = new AccountData(framework.Clock.DateTime, AccountDataType.Position, accountName, this.id, this.id); // or AccountDataType.AccountValue
data.Fields.Add(fieldName, currency, fieldValue);
EmitAccountData(data);