12 lines
442 B
C#
12 lines
442 B
C#
namespace KLHZ.Trader.Core.Exchange.Utils
|
|
{
|
|
internal static class TradingCalculator
|
|
{
|
|
public static decimal CaclProfit(decimal openPrice, decimal closePrice, decimal comission, decimal leverage, bool isShort)
|
|
{
|
|
var diff = ((isShort ? (closePrice - openPrice) : (openPrice - closePrice)) - closePrice * comission - openPrice * comission) * leverage;
|
|
return diff;
|
|
}
|
|
}
|
|
}
|