@@ -39,6 +39,33 @@ public Task<AccountSummaryResponse> GetAccountSummaryAsync(string currency, int?
3939
4040 return _deribitClient . InvokeAsync < IReadOnlyCollection < PositionResult > > ( "private/get_positions" , requestObject ) ;
4141 }
42+
43+ public Task < TransactionLogResult > GetTransactionLogAsync ( CurrencyKind currency , DateTimeOffset startDate ,
44+ DateTimeOffset endDate , string ? query = null , int count = 100 , int ? continuation = null )
45+ {
46+ dynamic requestObject = new ExpandoObject ( ) ;
47+ requestObject . currency = currency ;
48+ requestObject . start_timestamp = startDate . ToUnixTimeMilliseconds ( ) ;
49+ requestObject . end_timestamp = endDate . ToUnixTimeMilliseconds ( ) ;
50+ if ( query != null ) requestObject . query = query ;
51+ requestObject . count = count ;
52+ if ( continuation . HasValue ) requestObject . continuation = continuation . Value ;
53+
54+ return _deribitClient . InvokeAsync < TransactionLogResult > ( "private/get_transaction_log" , requestObject ) ;
55+ }
56+
57+ public async IAsyncEnumerable < TransactionLogEntry > GetAllTransactionLogsAsync ( CurrencyKind currency ,
58+ DateTimeOffset startDate , DateTimeOffset endDate , string ? query = null , int countPerPage = 100 )
59+ {
60+ int ? continuation = null ;
61+ do
62+ {
63+ var result = await GetTransactionLogAsync ( currency , startDate , endDate , query , countPerPage , continuation ) ;
64+ continuation = result . Continuation ;
65+ foreach ( var log in result . Logs ?? Array . Empty < TransactionLogEntry > ( ) )
66+ yield return log ;
67+ } while ( continuation != null ) ;
68+ }
4269}
4370
4471public class PositionResult
@@ -99,4 +126,43 @@ public enum PositionDirection
99126 Zero ,
100127 Buy ,
101128 Sell
102- }
129+ }
130+
131+ public class TransactionLogResult
132+ {
133+ public int ? Continuation { get ; set ; }
134+ public IReadOnlyCollection < TransactionLogEntry > ? Logs { get ; set ; }
135+ }
136+
137+ public class TransactionLogEntry
138+ {
139+ public decimal Amount { get ; set ; }
140+ public decimal Balance { get ; set ; }
141+ public decimal Cashflow { get ; set ; }
142+ public decimal Change { get ; set ; }
143+ public decimal ? Commission { get ; set ; }
144+ public decimal ? Contracts { get ; set ; }
145+ public required string Currency { get ; set ; }
146+ public decimal Equity { get ; set ; }
147+ public long Id { get ; set ; }
148+ public object ? Info { get ; set ; }
149+ public string ? InstrumentName { get ; set ; }
150+ public decimal InterestPl { get ; set ; }
151+ public decimal MarkPrice { get ; set ; }
152+ public string ? OrderId { get ; set ; }
153+ public decimal ? Position { get ; set ; }
154+ public decimal ? Price { get ; set ; }
155+ public string ? PriceCurrency { get ; set ; }
156+ public bool ProfitAsCashflow { get ; set ; }
157+ public decimal SessionRpl { get ; set ; }
158+ public decimal SessionUpl { get ; set ; }
159+ public string ? Side { get ; set ; }
160+ public long Timestamp { get ; set ; }
161+ public decimal TotalInterestPl { get ; set ; }
162+ public string ? TradeId { get ; set ; }
163+ public required string Type { get ; set ; }
164+ public long UserId { get ; set ; }
165+ public string ? UserRole { get ; set ; }
166+ public long UserSeq { get ; set ; }
167+ public required string Username { get ; set ; }
168+ }
0 commit comments