-
Notifications
You must be signed in to change notification settings - Fork 1
/
ledgers.go
59 lines (46 loc) · 1.69 KB
/
ledgers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package gokraken
import (
"time"
"github.com/danmrichards/gokraken/asset"
)
const (
// LedgersResource is the API resource for the Kraken API ledgers endpoint.
LedgersResource = "Ledgers"
// LedgerTypeAll is used to list all ledgers.
LedgerTypeAll LedgerType = "all"
// LedgerTypeDeposit is used to list deposit ledgers.
LedgerTypeDeposit LedgerType = "deposit"
// LedgerTypeWithdrawal is used to list withdrawal ledgers.
LedgerTypeWithdrawal LedgerType = "withdrawal"
// LedgerTypeTrade is used to list trade ledgers.
LedgerTypeTrade LedgerType = "trade"
// LedgerTypeMargin is used to list margin ledgers.
LedgerTypeMargin LedgerType = "margin"
// QueryLedgersResource is the API resource for the Kraken API query ledgers endpoint.
QueryLedgersResource = "QueryLedgers"
)
// LedgerType is a type of kraken ledger.
type LedgerType string
// LedgersRequest represents a request to list ledger information from Kraken.
type LedgersRequest struct {
Aclass AssetsClass // Asset class.
Assets []asset.Currency // List of assets to restrict output to.
Type LedgerType // Type of ledger to retrieve.
Start *time.Time // Starting timestamp.
End *time.Time // Ending timestamp.
Ofs int // Offset.
}
// LedgersResponse represents the response from the OpenPositions endpoint
// of the Kraken API.
type LedgersResponse map[string]Ledger
// Ledger represent a Kraken ledger entry.
type Ledger struct {
Refid string `json:"refid"`
Time int64 `json:"time"`
Type string `json:"type"`
Aclass string `json:"aclass"`
Asset string `json:"asset"`
Amount float64 `json:"amount"`
Fee float64 `json:"fee"`
Balance float64 `json:"balance"`
}