Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Common/Brokerages/dYdXBrokerageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ public dYdXBrokerageModel(AccountType accountType = AccountType.Margin) : base(a
}
}

/// <summary>
/// Gets a new buying power model for the security, returning the default model with the security's configured leverage.
/// For cash accounts, leverage = 1 is used.
/// </summary>
/// <param name="security">The security to get a buying power model for</param>
/// <returns>The buying power model for this brokerage/security</returns>
public override IBuyingPowerModel GetBuyingPowerModel(Security security)
{
return security?.Type switch
{
SecurityType.CryptoFuture => new SecurityMarginModel(GetLeverage(security)),
_ => base.GetBuyingPowerModel(security)
};
}

/// <summary>
/// Provides dYdX fee model
/// </summary>
Expand Down Expand Up @@ -145,4 +160,4 @@ private static IReadOnlyDictionary<SecurityType, string> GetDefaultMarkets(strin
map[SecurityType.CryptoFuture] = marketName;
return map.ToReadOnlyDictionary();
}
}
}
Loading