@@ -181,6 +181,10 @@ type Order struct {
181181 DisableMarketProtection bool `json:"disableMarketProtection"`
182182 TimeInForce string `json:"timeInForce"`
183183 PostOnly bool `json:"postOnly"`
184+ TriggerAmount string `json:"triggerAmount"`
185+ TriggerPrice string `json:"triggerPrice"`
186+ TriggerType string `json:"triggerType"`
187+ TriggerReference string `json:"triggerReference"`
184188}
185189
186190type Fill struct {
@@ -246,6 +250,21 @@ type Trades struct {
246250 Settled bool `json:"settled"`
247251}
248252
253+ type AccountResponse struct {
254+ Action string `json:"action"`
255+ Response Account `json:"response"`
256+ }
257+
258+ type Account struct {
259+ Fees FeeObject `json:"fees"`
260+ }
261+
262+ type FeeObject struct {
263+ Taker string `json:"taker"`
264+ Maker string `json:"maker"`
265+ Volume string `json:"volume"`
266+ }
267+
249268type BalanceResponse struct {
250269 Action string `json:"action"`
251270 Response []Balance `json:"response"`
@@ -350,6 +369,10 @@ type SubscriptionAccountOrder struct {
350369 PostOnly bool `json:"postOnly"`
351370 SelfTradePrevention string `json:"selfTradePrevention"`
352371 Visible bool `json:"visible"`
372+ TriggerAmount string `json:"triggerAmount"`
373+ TriggerPrice string `json:"triggerPrice"`
374+ TriggerType string `json:"triggerType"`
375+ TriggerReference string `json:"triggerReference"`
353376}
354377
355378type SubscriptionCandlesResponse struct {
@@ -489,6 +512,7 @@ type Websocket struct {
489512 cancelOrdersChannel chan []CancelOrder
490513 ordersOpenChannel chan []Order
491514 tradesChannel chan []Trades
515+ accountChannel chan Account
492516 balanceChannel chan []Balance
493517 depositAssetsChannel chan DepositAssets
494518 withdrawAssetsChannel chan WithdrawAssets
@@ -814,7 +838,10 @@ func (bitvavo Bitvavo) Ticker24h(options map[string]string) ([]Ticker24h, error)
814838 return t , nil
815839}
816840
817- // optional body parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection), both: timeInForce, selfTradePrevention, responseRequired
841+ // optional body parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection)
842+ // stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
843+ // stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
844+ // all orderTypes: timeInForce, selfTradePrevention, responseRequired
818845func (bitvavo Bitvavo ) PlaceOrder (market string , side string , orderType string , body map [string ]string ) (Order , error ) {
819846 body ["market" ] = market
820847 body ["side" ] = side
@@ -847,7 +874,8 @@ func (bitvavo Bitvavo) GetOrder(market string, orderId string) (Order, error) {
847874}
848875
849876// Optional body parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
850- // (set at least 1) (responseRequired can be set as well, but does not update anything)
877+ // untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
878+ // stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
851879func (bitvavo Bitvavo ) UpdateOrder (market string , orderId string , body map [string ]string ) (Order , error ) {
852880 body ["market" ] = market
853881 body ["orderId" ] = orderId
@@ -928,6 +956,16 @@ func (bitvavo Bitvavo) Trades(market string, options map[string]string) ([]Trade
928956 return t , nil
929957}
930958
959+ func (bitvavo Bitvavo ) Account () (Account , error ) {
960+ jsonResponse := bitvavo .sendPrivate ("/account" , "" , map [string ]string {}, "GET" )
961+ var t Account
962+ err := json .Unmarshal (jsonResponse , & t )
963+ if err != nil {
964+ return Account {}, MyError {Err : err }
965+ }
966+ return t , nil
967+ }
968+
931969// options: symbol
932970func (bitvavo Bitvavo ) Balance (options map [string ]string ) ([]Balance , error ) {
933971 postfix := bitvavo .createPostfix (options )
@@ -1367,6 +1405,13 @@ func (bitvavo Bitvavo) handleMessage(ws *Websocket) {
13671405 return
13681406 }
13691407 ws .tradesChannel <- t .Response
1408+ } else if x ["action" ] == "privateGetAccount" {
1409+ var t AccountResponse
1410+ err = json .Unmarshal (message , & t )
1411+ if handleError (err ) {
1412+ return
1413+ }
1414+ ws .accountChannel <- t .Response
13701415 } else if x ["action" ] == "privateGetBalance" {
13711416 var t BalanceResponse
13721417 err = json .Unmarshal (message , & t )
@@ -1549,7 +1594,10 @@ func (ws *Websocket) sendPrivate(msg []byte) {
15491594 }
15501595}
15511596
1552- // optional body parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection), both: timeInForce, selfTradePrevention, responseRequired
1597+ // optional body parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection)
1598+ // stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
1599+ // stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
1600+ // all orderTypes: timeInForce, selfTradePrevention, responseRequired
15531601func (ws * Websocket ) PlaceOrder (market string , side string , orderType string , body map [string ]string ) chan Order {
15541602 body ["market" ] = market
15551603 body ["side" ] = side
@@ -1570,7 +1618,8 @@ func (ws *Websocket) GetOrder(market string, orderId string) chan Order {
15701618}
15711619
15721620// Optional body parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
1573- // (set at least 1) (responseRequired can be set as well, but does not update anything)
1621+ // untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
1622+ // stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
15741623func (ws * Websocket ) UpdateOrder (market string , orderId string , body map [string ]string ) chan Order {
15751624 ws .updateOrderChannel = make (chan Order , 100 )
15761625 body ["market" ] = market
@@ -1626,6 +1675,14 @@ func (ws *Websocket) Trades(market string, options map[string]string) chan []Tra
16261675 return ws .tradesChannel
16271676}
16281677
1678+ func (ws * Websocket ) Account () chan Account {
1679+ ws .accountChannel = make (chan Account , 100 )
1680+ options := map [string ]string {"action" : "privateGetAccount" }
1681+ myMessage , _ := json .Marshal (options )
1682+ go ws .sendPrivate (myMessage )
1683+ return ws .accountChannel
1684+ }
1685+
16291686// options: symbol
16301687func (ws * Websocket ) Balance (options map [string ]string ) chan []Balance {
16311688 ws .balanceChannel = make (chan []Balance , 100 )
0 commit comments