Exemplo n.º 1
0
        public static void ShowAccountActivities(Account account)
        {
            Log.Write($"ShowAccountActivities for {account.Name} account");
            var accountingApi = new AccountingApi();

            foreach (var cashBalance in accountingApi.GetOwnedCashBalances(account.Id))
            {
                Log.Write(cashBalance);
            }
            var marginSnapshot = accountingApi.GetMarginSnapshot(account.Id);

            Log.Write(marginSnapshot);
            var balanceSnapshot = accountingApi.GetCashBalanceSnapshot(new GetCashBalanceSnapshot(account.Id));

            Log.Write(balanceSnapshot);
            var ordersApi = new OrdersApi();
            var orders    = ordersApi.GetOwnedOrders(account.Id);

            foreach (var order in orders)
            {
                Log.Write(order);
            }
            var accountOrders = orders.ToDictionary(x => x.Id);
            var fills         = ordersApi.GetAllFills().Where(fill => accountOrders.ContainsKey(fill.OrderId));

            foreach (var fill in fills)
            {
                Log.Write(fill);
            }
            var positionsApi = new PositionsApi();

            foreach (var position in positionsApi.GetOwnedPositions(account.Id))
            {
                Log.Write(position);
            }
        }