github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/docs/rest_v2.md (about) 1 # rest 2 -- 3 import "github.com/bitfinexcom/bitfinex-api-go/v2/rest" 4 5 6 ## Usage 7 8 ```go 9 const ( 10 DERIV_TYPE = "deriv" 11 ) 12 ``` 13 14 #### type AveragePriceRequest 15 16 ```go 17 type AveragePriceRequest struct { 18 Symbol string 19 Amount string 20 RateLimit string 21 Period int 22 } 23 ``` 24 25 AveragePriceRequest data structure for constructing average price query params 26 27 #### type BookService 28 29 ```go 30 type BookService struct { 31 Synchronous 32 } 33 ``` 34 35 36 #### func (*BookService) All 37 38 ```go 39 func (b *BookService) All(symbol string, precision common.BookPrecision, priceLevels int) (*book.Snapshot, error) 40 ``` 41 All - retrieve all books for the given symbol with the given precision at the 42 given price level see https://docs.bitfinex.com/reference#rest-public-books for 43 more info 44 45 #### type CancelOrderMultiRequest 46 47 ```go 48 type CancelOrderMultiRequest struct { 49 OrderIDs OrderIDs `json:"id,omitempty"` 50 GroupOrderIDs GroupOrderIDs `json:"gid,omitempty"` 51 ClientOrderIDs ClientOrderIDs `json:"cid,omitempty"` 52 All int `json:"all,omitempty"` 53 } 54 ``` 55 56 CancelOrderMultiRequest - data structure for constructing cancel order multi 57 request payload 58 59 #### type CandleService 60 61 ```go 62 type CandleService struct { 63 Synchronous 64 } 65 ``` 66 67 CandleService manages the Candles endpoint. 68 69 #### func (*CandleService) History 70 71 ```go 72 func (c *CandleService) History(symbol string, resolution common.CandleResolution) (*candle.Snapshot, error) 73 ``` 74 History - retrieves all candles (Max=1000) with the given symbol and the given 75 candle resolution See https://docs.bitfinex.com/reference#rest-public-candles 76 for more info 77 78 #### func (*CandleService) HistoryWithQuery 79 80 ```go 81 func (c *CandleService) HistoryWithQuery( 82 symbol string, 83 resolution common.CandleResolution, 84 start common.Mts, 85 end common.Mts, 86 limit common.QueryLimit, 87 sort common.SortOrder, 88 ) (*candle.Snapshot, error) 89 ``` 90 HistoryWithQuery - retrieves all candles (Max=1000) that fit the given query 91 criteria See https://docs.bitfinex.com/reference#rest-public-candles for more 92 info 93 94 #### func (*CandleService) Last 95 96 ```go 97 func (c *CandleService) Last(symbol string, resolution common.CandleResolution) (*candle.Candle, error) 98 ``` 99 Last - retrieve the last candle for the given symbol with the given resolution 100 See https://docs.bitfinex.com/reference#rest-public-candles for more info 101 102 #### type Client 103 104 ```go 105 type Client struct { 106 107 // service providers 108 Candles CandleService 109 Orders OrderService 110 Positions PositionService 111 Trades TradeService 112 Tickers TickerService 113 Currencies CurrenciesService 114 Platform PlatformService 115 Book BookService 116 Wallet WalletService 117 Ledgers LedgerService 118 Stats StatsService 119 Status StatusService 120 Derivatives DerivativesService 121 Funding FundingService 122 Pulse PulseService 123 Invoice InvoiceService 124 Market MarketService 125 126 Synchronous 127 } 128 ``` 129 130 131 #### func NewClient 132 133 ```go 134 func NewClient() *Client 135 ``` 136 Create a new Rest client 137 138 #### func NewClientWithHttpDo 139 140 ```go 141 func NewClientWithHttpDo(httpDo func(c *http.Client, r *http.Request) (*http.Response, error)) *Client 142 ``` 143 Create a new Rest client with a custom http handler 144 145 #### func NewClientWithSynchronousNonce 146 147 ```go 148 func NewClientWithSynchronousNonce(sync Synchronous, nonce utils.NonceGenerator) *Client 149 ``` 150 Create a new Rest client with a synchronous HTTP handler and a custom nonce 151 generaotr 152 153 #### func NewClientWithSynchronousURLNonce 154 155 ```go 156 func NewClientWithSynchronousURLNonce(sync Synchronous, url string, nonce utils.NonceGenerator) *Client 157 ``` 158 Create a new Rest client with a synchronous HTTP handler and a custom base url 159 and nonce generator 160 161 #### func NewClientWithURL 162 163 ```go 164 func NewClientWithURL(url string) *Client 165 ``` 166 Create a new Rest client with a custom base url 167 168 #### func NewClientWithURLHttpDo 169 170 ```go 171 func NewClientWithURLHttpDo(base string, httpDo func(c *http.Client, r *http.Request) (*http.Response, error)) *Client 172 ``` 173 Create a new Rest client with a custom base url and HTTP handler 174 175 #### func NewClientWithURLHttpDoNonce 176 177 ```go 178 func NewClientWithURLHttpDoNonce(base string, httpDo func(c *http.Client, r *http.Request) (*http.Response, error), nonce utils.NonceGenerator) *Client 179 ``` 180 Create a new Rest client with a custom base url, HTTP handler and none generator 181 182 #### func NewClientWithURLNonce 183 184 ```go 185 func NewClientWithURLNonce(url string, nonce utils.NonceGenerator) *Client 186 ``` 187 Create a new Rest client with a custom nonce generator 188 189 #### func (*Client) Credentials 190 191 ```go 192 func (c *Client) Credentials(key string, secret string) *Client 193 ``` 194 Set the clients credentials in order to make authenticated requests 195 196 #### func (*Client) NewAuthenticatedRequest 197 198 ```go 199 func (c *Client) NewAuthenticatedRequest(permissionType common.PermissionType, refURL string) (Request, error) 200 ``` 201 Create a new authenticated GET request with the given permission type and 202 endpoint url For example permissionType = "r" and refUrl = "/orders" then the 203 target endpoint will be https://api.bitfinex.com/v2/auth/r/orders/:Symbol 204 205 #### func (*Client) NewAuthenticatedRequestWithBytes 206 207 ```go 208 func (c *Client) NewAuthenticatedRequestWithBytes(permissionType common.PermissionType, refURL string, data []byte) (Request, error) 209 ``` 210 Create a new authenticated POST request with the given permission type,endpoint 211 url and data (bytes) as the body For example permissionType = "r" and refUrl = 212 "/orders" then the target endpoint will be 213 https://api.bitfinex.com/v2/auth/r/orders/:Symbol 214 215 #### func (*Client) NewAuthenticatedRequestWithData 216 217 ```go 218 func (c *Client) NewAuthenticatedRequestWithData(permissionType common.PermissionType, refURL string, data map[string]interface{}) (Request, error) 219 ``` 220 Create a new authenticated POST request with the given permission type,endpoint 221 url and data (map[string]interface{}) as the body For example permissionType = 222 "r" and refUrl = "/orders" then the target endpoint will be 223 https://api.bitfinex.com/v2/auth/r/orders/:Symbol 224 225 #### type ClientOrderIDs 226 227 ```go 228 type ClientOrderIDs [][]interface{} 229 ``` 230 231 232 #### type CurrenciesService 233 234 ```go 235 type CurrenciesService struct { 236 Synchronous 237 } 238 ``` 239 240 CurrenciesService manages the conf endpoint. 241 242 #### func (*CurrenciesService) Conf 243 244 ```go 245 func (cs *CurrenciesService) Conf(label, symbol, unit, explorer, pairs bool) ([]currency.Conf, error) 246 ``` 247 Conf - retreive currency and symbol service configuration data see 248 https://docs.bitfinex.com/reference#rest-public-conf for more info 249 250 #### type DepositInvoiceRequest 251 252 ```go 253 type DepositInvoiceRequest struct { 254 Currency string `json:"currency,omitempty"` 255 Wallet string `json:"wallet,omitempty"` 256 Amount string `json:"amount,omitempty"` 257 } 258 ``` 259 260 DepositInvoiceRequest - data structure for constructing deposit invoice request 261 payload 262 263 #### type DerivativesService 264 265 ```go 266 type DerivativesService struct { 267 Synchronous 268 } 269 ``` 270 271 OrderService manages data flow for the Order API endpoint 272 273 #### type ErrorResponse 274 275 ```go 276 type ErrorResponse struct { 277 Response *Response 278 Message string `json:"message"` 279 Code int `json:"code"` 280 } 281 ``` 282 283 In case if API will wrong response code ErrorResponse will be returned to caller 284 285 #### func (*ErrorResponse) Error 286 287 ```go 288 func (r *ErrorResponse) Error() string 289 ``` 290 291 #### type ForeignExchangeRateRequest 292 293 ```go 294 type ForeignExchangeRateRequest struct { 295 FirstCurrency string `json:"ccy1"` 296 SecondCurrency string `json:"ccy2"` 297 } 298 ``` 299 300 ForeignExchangeRateRequest data structure for constructing foreign exchange rate 301 request payload 302 303 #### type FundingService 304 305 ```go 306 type FundingService struct { 307 Synchronous 308 } 309 ``` 310 311 FundingService manages the Funding endpoint. 312 313 #### func (*FundingService) CancelOffer 314 315 ```go 316 func (fs *FundingService) CancelOffer(fc *fundingoffer.CancelRequest) (*notification.Notification, error) 317 ``` 318 Submits a request to cancel the given offer see 319 https://docs.bitfinex.com/reference#cancel-funding-offer for more info 320 321 #### func (*FundingService) Credits 322 323 ```go 324 func (fs *FundingService) Credits(symbol string) (*fundingcredit.Snapshot, error) 325 ``` 326 Retreive all of the active credits used in positions see 327 https://docs.bitfinex.com/reference#rest-auth-funding-credits for more info 328 329 #### func (*FundingService) CreditsHistory 330 331 ```go 332 func (fs *FundingService) CreditsHistory(symbol string) (*fundingcredit.Snapshot, error) 333 ``` 334 Retreive all of the past in-active credits used in positions see 335 https://docs.bitfinex.com/reference#rest-auth-funding-credits-hist for more info 336 337 #### func (*FundingService) KeepFunding 338 339 ```go 340 func (fs *FundingService) KeepFunding(args KeepFundingRequest) (*notification.Notification, error) 341 ``` 342 KeepFunding - toggle to keep funding taken. Specify loan for unused funding and 343 credit for used funding. see 344 https://docs.bitfinex.com/reference#rest-auth-keep-funding for more info 345 346 #### func (*FundingService) Loans 347 348 ```go 349 func (fs *FundingService) Loans(symbol string) (*fundingloan.Snapshot, error) 350 ``` 351 Retreive all of the active funding loans see 352 https://docs.bitfinex.com/reference#rest-auth-funding-loans for more info 353 354 #### func (*FundingService) LoansHistory 355 356 ```go 357 func (fs *FundingService) LoansHistory(symbol string) (*fundingloan.Snapshot, error) 358 ``` 359 Retreive all of the past in-active funding loans see 360 https://docs.bitfinex.com/reference#rest-auth-funding-loans-hist for more info 361 362 #### func (*FundingService) OfferHistory 363 364 ```go 365 func (fs *FundingService) OfferHistory(symbol string) (*fundingoffer.Snapshot, error) 366 ``` 367 Retreive all of the past in-active funding offers see 368 https://docs.bitfinex.com/reference#rest-auth-funding-offers-hist for more info 369 370 #### func (*FundingService) Offers 371 372 ```go 373 func (fs *FundingService) Offers(symbol string) (*fundingoffer.Snapshot, error) 374 ``` 375 Retreive all of the active fundign offers see 376 https://docs.bitfinex.com/reference#rest-auth-funding-offers for more info 377 378 #### func (*FundingService) SubmitOffer 379 380 ```go 381 func (fs *FundingService) SubmitOffer(fo *fundingoffer.SubmitRequest) (*notification.Notification, error) 382 ``` 383 Submits a request to create a new funding offer see 384 https://docs.bitfinex.com/reference#submit-funding-offer for more info 385 386 #### func (*FundingService) Trades 387 388 ```go 389 func (fs *FundingService) Trades(symbol string) (*fundingtrade.Snapshot, error) 390 ``` 391 Retreive all of the matched funding trades see 392 https://docs.bitfinex.com/reference#rest-auth-funding-trades-hist for more info 393 394 #### type GroupOrderIDs 395 396 ```go 397 type GroupOrderIDs []int 398 ``` 399 400 401 #### type HttpTransport 402 403 ```go 404 type HttpTransport struct { 405 BaseURL *url.URL 406 HTTPClient *http.Client 407 } 408 ``` 409 410 411 #### func (HttpTransport) Request 412 413 ```go 414 func (h HttpTransport) Request(req Request) ([]interface{}, error) 415 ``` 416 417 #### type InvoiceService 418 419 ```go 420 type InvoiceService struct { 421 Synchronous 422 } 423 ``` 424 425 InvoiceService manages Invoice endpoint 426 427 #### func (*InvoiceService) GenerateInvoice 428 429 ```go 430 func (is *InvoiceService) GenerateInvoice(payload DepositInvoiceRequest) (*invoice.Invoice, error) 431 ``` 432 GenerateInvoice generates a Lightning Network deposit invoice Accepts 433 DepositInvoiceRequest type as argument 434 https://docs.bitfinex.com/reference#rest-auth-deposit-invoice 435 436 #### type KeepFundingRequest 437 438 ```go 439 type KeepFundingRequest struct { 440 Type string `json:"type"` 441 ID int `json:"id"` 442 } 443 ``` 444 445 KeepFundingRequest - data structure for constructing keep funding request 446 payload 447 448 #### type LedgerService 449 450 ```go 451 type LedgerService struct { 452 Synchronous 453 } 454 ``` 455 456 LedgerService manages the Ledgers endpoint. 457 458 #### func (*LedgerService) Ledgers 459 460 ```go 461 func (s *LedgerService) Ledgers(currency string, start int64, end int64, max int32) (*ledger.Snapshot, error) 462 ``` 463 Ledgers - all of the past ledger entreies see 464 https://docs.bitfinex.com/reference#ledgers for more info 465 466 #### type MarketService 467 468 ```go 469 type MarketService struct { 470 Synchronous 471 } 472 ``` 473 474 475 #### func (*MarketService) AveragePrice 476 477 ```go 478 func (ms *MarketService) AveragePrice(pld AveragePriceRequest) ([]float64, error) 479 ``` 480 AveragePrice Calculate the average execution price for Trading or rate for 481 Margin funding. See: 482 https://docs.bitfinex.com/reference#rest-public-calc-market-average-price 483 484 #### func (*MarketService) ForeignExchangeRate 485 486 ```go 487 func (ms *MarketService) ForeignExchangeRate(pld ForeignExchangeRateRequest) ([]float64, error) 488 ``` 489 ForeignExchangeRate - Calculate the exchange rate between two currencies See: 490 https://docs.bitfinex.com/reference#rest-public-calc-foreign-exchange-rate 491 492 #### type Nickname 493 494 ```go 495 type Nickname string 496 ``` 497 498 499 #### type OrderIDs 500 501 ```go 502 type OrderIDs []int 503 ``` 504 505 506 #### type OrderMultiOpsRequest 507 508 ```go 509 type OrderMultiOpsRequest struct { 510 Ops OrderOps `json:"ops"` 511 } 512 ``` 513 514 OrderMultiOpsRequest - data structure for constructing order multi ops request 515 payload 516 517 #### type OrderOps 518 519 ```go 520 type OrderOps [][]interface{} 521 ``` 522 523 524 #### type OrderService 525 526 ```go 527 type OrderService struct { 528 Synchronous 529 } 530 ``` 531 532 OrderService manages data flow for the Order API endpoint 533 534 #### func (*OrderService) All 535 536 ```go 537 func (s *OrderService) All() (*order.Snapshot, error) 538 ``` 539 Retrieves all of the active orders See 540 https://docs.bitfinex.com/reference#rest-auth-orders for more info 541 542 #### func (*OrderService) AllHistory 543 544 ```go 545 func (s *OrderService) AllHistory() (*order.Snapshot, error) 546 ``` 547 Retrieves all past orders See https://docs.bitfinex.com/reference#orders-history 548 for more info 549 550 #### func (*OrderService) CancelOrderMulti 551 552 ```go 553 func (s *OrderService) CancelOrderMulti(args CancelOrderMultiRequest) (*notification.Notification, error) 554 ``` 555 CancelOrderMulti cancels multiple orders simultaneously. Orders can be canceled 556 based on the Order ID, the combination of Client Order ID and Client Order Date, 557 or the Group Order ID. Alternatively, the body param 'all' can be used with a 558 value of 1 to cancel all orders. see 559 https://docs.bitfinex.com/reference#rest-auth-order-cancel-multi for more info 560 561 #### func (*OrderService) CancelOrderMultiOp 562 563 ```go 564 func (s *OrderService) CancelOrderMultiOp(orderID int) (*notification.Notification, error) 565 ``` 566 CancelOrderMultiOp cancels order. Accepts orderID to be canceled. see 567 https://docs.bitfinex.com/reference#rest-auth-order-multi for more info 568 569 #### func (*OrderService) CancelOrdersMultiOp 570 571 ```go 572 func (s *OrderService) CancelOrdersMultiOp(ids OrderIDs) (*notification.Notification, error) 573 ``` 574 CancelOrdersMultiOp cancels multiple orders simultaneously. Accepts a slice of 575 order ID's to be canceled. see 576 https://docs.bitfinex.com/reference#rest-auth-order-multi for more info 577 578 #### func (*OrderService) GetByOrderId 579 580 ```go 581 func (s *OrderService) GetByOrderId(orderID int64) (o *order.Order, err error) 582 ``` 583 Retrieve an active order by the given ID See 584 https://docs.bitfinex.com/reference#rest-auth-orders for more info 585 586 #### func (*OrderService) GetBySymbol 587 588 ```go 589 func (s *OrderService) GetBySymbol(symbol string) (*order.Snapshot, error) 590 ``` 591 Retrieves all of the active orders with for the given symbol See 592 https://docs.bitfinex.com/reference#rest-auth-orders for more info 593 594 #### func (*OrderService) GetHistoryByOrderId 595 596 ```go 597 func (s *OrderService) GetHistoryByOrderId(orderID int64) (o *order.Order, err error) 598 ``` 599 Retrieve a single order in history with the given id See 600 https://docs.bitfinex.com/reference#orders-history for more info 601 602 #### func (*OrderService) GetHistoryBySymbol 603 604 ```go 605 func (s *OrderService) GetHistoryBySymbol(symbol string) (*order.Snapshot, error) 606 ``` 607 Retrieves all past orders with the given symbol See 608 https://docs.bitfinex.com/reference#orders-history for more info 609 610 #### func (*OrderService) OrderMultiOp 611 612 ```go 613 func (s *OrderService) OrderMultiOp(ops OrderOps) (*notification.Notification, error) 614 ``` 615 OrderMultiOp - send Multiple order-related operations. Please note the sent 616 object has only one property with a value of a slice of slices detailing each 617 order operation. see https://docs.bitfinex.com/reference#rest-auth-order-multi 618 for more info 619 620 #### func (*OrderService) OrderNewMultiOp 621 622 ```go 623 func (s *OrderService) OrderNewMultiOp(onr order.NewRequest) (*notification.Notification, error) 624 ``` 625 OrderNewMultiOp creates new order. Accepts instance of order.NewRequest see 626 https://docs.bitfinex.com/reference#rest-auth-order-multi for more info 627 628 #### func (*OrderService) OrderTrades 629 630 ```go 631 func (s *OrderService) OrderTrades(symbol string, orderID int64) (*tradeexecutionupdate.Snapshot, error) 632 ``` 633 Retrieves the trades generated by an order See 634 https://docs.bitfinex.com/reference#orders-history for more info 635 636 #### func (*OrderService) OrderUpdateMultiOp 637 638 ```go 639 func (s *OrderService) OrderUpdateMultiOp(our order.UpdateRequest) (*notification.Notification, error) 640 ``` 641 OrderUpdateMultiOp updates order. Accepts instance of order.UpdateRequest see 642 https://docs.bitfinex.com/reference#rest-auth-order-multi for more info 643 644 #### func (*OrderService) SubmitCancelOrder 645 646 ```go 647 func (s *OrderService) SubmitCancelOrder(oc *order.CancelRequest) error 648 ``` 649 Submit a request to cancel an order with the given Id see 650 https://docs.bitfinex.com/reference#cancel-order for more info 651 652 #### func (*OrderService) SubmitOrder 653 654 ```go 655 func (s *OrderService) SubmitOrder(onr *order.NewRequest) (*notification.Notification, error) 656 ``` 657 Submit a request to create a new order see 658 https://docs.bitfinex.com/reference#submit-order for more info 659 660 #### func (*OrderService) SubmitUpdateOrder 661 662 ```go 663 func (s *OrderService) SubmitUpdateOrder(our *order.UpdateRequest) (*notification.Notification, error) 664 ``` 665 Submit a request to update an order with the given id with the given changes see 666 https://docs.bitfinex.com/reference#order-update for more info 667 668 #### type PlatformService 669 670 ```go 671 type PlatformService struct { 672 Synchronous 673 } 674 ``` 675 676 677 #### func (*PlatformService) Status 678 679 ```go 680 func (p *PlatformService) Status() (bool, error) 681 ``` 682 Retrieves the current status of the platform see 683 https://docs.bitfinex.com/reference#rest-public-platform-status for more info 684 685 #### type PositionService 686 687 ```go 688 type PositionService struct { 689 Synchronous 690 } 691 ``` 692 693 PositionService manages the Position endpoint. 694 695 #### func (*PositionService) All 696 697 ```go 698 func (s *PositionService) All() (*position.Snapshot, error) 699 ``` 700 All - retrieves all of the active positions see 701 https://docs.bitfinex.com/reference#rest-auth-positions for more info 702 703 #### func (*PositionService) Claim 704 705 ```go 706 func (s *PositionService) Claim(cp *position.ClaimRequest) (*notification.Notification, error) 707 ``` 708 Claim - submits a request to claim an active position with the given id see 709 https://docs.bitfinex.com/reference#claim-position for more info 710 711 #### type PulseService 712 713 ```go 714 type PulseService struct { 715 Synchronous 716 } 717 ``` 718 719 720 #### func (*PulseService) AddComment 721 722 ```go 723 func (ps *PulseService) AddComment(p *pulse.Pulse) (*pulse.Pulse, error) 724 ``` 725 AddComment submits pulse comment see 726 https://docs.bitfinex.com/reference#rest-auth-pulse-add 727 728 #### func (*PulseService) AddPulse 729 730 ```go 731 func (ps *PulseService) AddPulse(p *pulse.Pulse) (*pulse.Pulse, error) 732 ``` 733 AddPulse submits pulse message see 734 https://docs.bitfinex.com/reference#rest-auth-pulse-add 735 736 #### func (*PulseService) DeletePulse 737 738 ```go 739 func (ps *PulseService) DeletePulse(pid string) (int, error) 740 ``` 741 DeletePulse removes your pulse message. Returns 0 if no pulse was deleted and 1 742 if it was see https://docs.bitfinex.com/reference#rest-auth-pulse-del 743 744 #### func (*PulseService) PublicPulseHistory 745 746 ```go 747 func (ps *PulseService) PublicPulseHistory(limit int, end common.Mts) ([]*pulse.Pulse, error) 748 ``` 749 PublicPulseHistory returns latest pulse messages. You can specify an end 750 timestamp to view older messages. see 751 https://docs.bitfinex.com/reference#rest-public-pulse-hist 752 753 #### func (*PulseService) PublicPulseProfile 754 755 ```go 756 func (ps *PulseService) PublicPulseProfile(nickname Nickname) (*pulseprofile.PulseProfile, error) 757 ``` 758 PublicPulseProfile returns details for a specific Pulse profile 759 https://docs.bitfinex.com/reference#rest-public-pulse-profile 760 761 #### func (*PulseService) PulseHistory 762 763 ```go 764 func (ps *PulseService) PulseHistory() ([]*pulse.Pulse, error) 765 ``` 766 PulseHistory allows you to retrieve your pulse history. see 767 https://docs.bitfinex.com/reference#rest-auth-pulse-hist 768 769 #### type Request 770 771 ```go 772 type Request struct { 773 RefURL string // ref url 774 Data []byte // body data 775 Method string // http method 776 Params url.Values // query parameters 777 Headers map[string]string 778 } 779 ``` 780 781 Request is a wrapper for standard http.Request. Default method is POST with no 782 data. 783 784 #### func NewRequest 785 786 ```go 787 func NewRequest(refURL string) Request 788 ``` 789 Create new POST request with an empty body as payload 790 791 #### func NewRequestWithBytes 792 793 ```go 794 func NewRequestWithBytes(refURL string, data []byte) Request 795 ``` 796 Create a new POST request with the given bytes as body 797 798 #### func NewRequestWithData 799 800 ```go 801 func NewRequestWithData(refURL string, data map[string]interface{}) (Request, error) 802 ``` 803 Create a new POST request with the given data (map[string]interface{}) as body 804 805 #### func NewRequestWithDataMethod 806 807 ```go 808 func NewRequestWithDataMethod(refURL string, data []byte, method string) Request 809 ``` 810 Create a new request with a given method (POST | GET) with bytes as body 811 812 #### func NewRequestWithMethod 813 814 ```go 815 func NewRequestWithMethod(refURL string, method string) Request 816 ``` 817 Create a new request with the given method (POST | GET) 818 819 #### type Response 820 821 ```go 822 type Response struct { 823 Response *http.Response 824 Body []byte 825 } 826 ``` 827 828 Response is a wrapper for standard http.Response and provides more methods. 829 830 #### func (*Response) String 831 832 ```go 833 func (r *Response) String() string 834 ``` 835 String converts response body to string. An empty string will be returned if 836 error. 837 838 #### type StatsService 839 840 ```go 841 type StatsService struct { 842 Synchronous 843 } 844 ``` 845 846 StatsService manages the Stats endpoint. 847 848 #### func (*StatsService) CreditSizeHistory 849 850 ```go 851 func (ss *StatsService) CreditSizeHistory(symbol string, side common.OrderSide) ([]*stats.Stat, error) 852 ``` 853 Retrieves platform statistics for credit size history see 854 https://docs.bitfinex.com/reference#rest-public-stats for more info 855 856 #### func (*StatsService) CreditSizeLast 857 858 ```go 859 func (ss *StatsService) CreditSizeLast(symbol string, side common.OrderSide) (*stats.Stat, error) 860 ``` 861 Retrieves platform statistics for credit size last see 862 https://docs.bitfinex.com/reference#rest-public-stats for more info 863 864 #### func (*StatsService) FundingHistory 865 866 ```go 867 func (ss *StatsService) FundingHistory(symbol string) ([]*stats.Stat, error) 868 ``` 869 Retrieves platform statistics for funding history see 870 https://docs.bitfinex.com/reference#rest-public-stats for more info 871 872 #### func (*StatsService) FundingLast 873 874 ```go 875 func (ss *StatsService) FundingLast(symbol string) (*stats.Stat, error) 876 ``` 877 Retrieves platform statistics for funding last see 878 https://docs.bitfinex.com/reference#rest-public-stats for more info 879 880 #### func (*StatsService) PositionHistory 881 882 ```go 883 func (ss *StatsService) PositionHistory(symbol string, side common.OrderSide) ([]*stats.Stat, error) 884 ``` 885 Retrieves platform statistics for position history see 886 https://docs.bitfinex.com/reference#rest-public-stats for more info 887 888 #### func (*StatsService) PositionLast 889 890 ```go 891 func (ss *StatsService) PositionLast(symbol string, side common.OrderSide) (*stats.Stat, error) 892 ``` 893 Retrieves platform statistics for position last see 894 https://docs.bitfinex.com/reference#rest-public-stats for more info 895 896 #### func (*StatsService) SymbolCreditSizeHistory 897 898 ```go 899 func (ss *StatsService) SymbolCreditSizeHistory(fundingSymbol string, tradingSymbol string) ([]*stats.Stat, error) 900 ``` 901 Retrieves platform statistics for credit size history see 902 https://docs.bitfinex.com/reference#rest-public-stats for more info 903 904 #### func (*StatsService) SymbolCreditSizeLast 905 906 ```go 907 func (ss *StatsService) SymbolCreditSizeLast(fundingSymbol string, tradingSymbol string) (*stats.Stat, error) 908 ``` 909 Retrieves platform statistics for credit size last see 910 https://docs.bitfinex.com/reference#rest-public-stats for more info 911 912 #### type StatusService 913 914 ```go 915 type StatusService struct { 916 Synchronous 917 } 918 ``` 919 920 TradeService manages the Trade endpoint. 921 922 #### func (*StatusService) DerivativeStatus 923 924 ```go 925 func (ss *StatusService) DerivativeStatus(symbol string) (*derivatives.DerivativeStatus, error) 926 ``` 927 Retrieves derivative status information for the given symbol from the platform 928 see https://docs.bitfinex.com/reference#rest-public-status for more info 929 930 #### func (*StatusService) DerivativeStatusAll 931 932 ```go 933 func (ss *StatusService) DerivativeStatusAll() ([]*derivatives.DerivativeStatus, error) 934 ``` 935 Retrieves derivative status information for all symbols from the platform see 936 https://docs.bitfinex.com/reference#rest-public-status for more info 937 938 #### func (*StatusService) DerivativeStatusMulti 939 940 ```go 941 func (ss *StatusService) DerivativeStatusMulti(symbols []string) ([]*derivatives.DerivativeStatus, error) 942 ``` 943 Retrieves derivative status information for the given symbols from the platform 944 see https://docs.bitfinex.com/reference#rest-public-status for more info 945 946 #### type Synchronous 947 948 ```go 949 type Synchronous interface { 950 Request(request Request) ([]interface{}, error) 951 } 952 ``` 953 954 955 #### type TickerService 956 957 ```go 958 type TickerService struct { 959 Synchronous 960 } 961 ``` 962 963 TickerService manages the Ticker endpoint. 964 965 #### func (*TickerService) All 966 967 ```go 968 func (s *TickerService) All() ([]*ticker.Ticker, error) 969 ``` 970 All - retrieves all tickers for all symbols see 971 https://docs.bitfinex.com/reference#rest-public-ticker for more info 972 973 #### func (*TickerService) Get 974 975 ```go 976 func (s *TickerService) Get(symbol string) (*ticker.Ticker, error) 977 ``` 978 Get - retrieves the ticker for the given symbol see 979 https://docs.bitfinex.com/reference#rest-public-ticker for more info 980 981 #### func (*TickerService) GetMulti 982 983 ```go 984 func (s *TickerService) GetMulti(symbols []string) ([]*ticker.Ticker, error) 985 ``` 986 GetMulti - retrieves the tickers for the given symbols see 987 https://docs.bitfinex.com/reference#rest-public-ticker for more info 988 989 #### type TradeService 990 991 ```go 992 type TradeService struct { 993 Synchronous 994 } 995 ``` 996 997 TradeService manages the Trade endpoint. 998 999 #### func (*TradeService) AccountAll 1000 1001 ```go 1002 func (s *TradeService) AccountAll() (*tradeexecutionupdate.Snapshot, error) 1003 ``` 1004 Retrieves all matched trades for the account see 1005 https://docs.bitfinex.com/reference#rest-auth-trades-hist for more info 1006 1007 #### func (*TradeService) AccountAllWithSymbol 1008 1009 ```go 1010 func (s *TradeService) AccountAllWithSymbol(symbol string) (*tradeexecutionupdate.Snapshot, error) 1011 ``` 1012 Retrieves all matched trades with the given symbol for the account see 1013 https://docs.bitfinex.com/reference#rest-auth-trades-hist for more info 1014 1015 #### func (*TradeService) AccountHistoryWithQuery 1016 1017 ```go 1018 func (s *TradeService) AccountHistoryWithQuery( 1019 symbol string, 1020 start common.Mts, 1021 end common.Mts, 1022 limit common.QueryLimit, 1023 sort common.SortOrder, 1024 ) (*tradeexecutionupdate.Snapshot, error) 1025 ``` 1026 Queries all matched trades with group of optional parameters see 1027 https://docs.bitfinex.com/reference#rest-auth-trades-hist for more info 1028 1029 #### func (*TradeService) PublicHistoryWithQuery 1030 1031 ```go 1032 func (s *TradeService) PublicHistoryWithQuery( 1033 symbol string, 1034 start common.Mts, 1035 end common.Mts, 1036 limit common.QueryLimit, 1037 sort common.SortOrder, 1038 ) (*trade.Snapshot, error) 1039 ``` 1040 Queries all public trades with a group of optional paramters see 1041 https://docs.bitfinex.com/reference#rest-public-trades for more info 1042 1043 #### type WalletService 1044 1045 ```go 1046 type WalletService struct { 1047 Synchronous 1048 } 1049 ``` 1050 1051 WalletService manages data flow for the Wallet API endpoint 1052 1053 #### func (*WalletService) CreateDepositAddress 1054 1055 ```go 1056 func (ws *WalletService) CreateDepositAddress(wallet, method string) (*notification.Notification, error) 1057 ``` 1058 Submits a request to create a new deposit address for the give Bitfinex wallet. 1059 Old addresses are still valid. See 1060 https://docs.bitfinex.com/reference#deposit-address for more info 1061 1062 #### func (*WalletService) DepositAddress 1063 1064 ```go 1065 func (ws *WalletService) DepositAddress(wallet, method string) (*notification.Notification, error) 1066 ``` 1067 Retrieves the deposit address for the given Bitfinex wallet see 1068 https://docs.bitfinex.com/reference#deposit-address for more info 1069 1070 #### func (*WalletService) SetCollateral 1071 1072 ```go 1073 func (s *WalletService) SetCollateral(symbol string, amount float64) (bool, error) 1074 ``` 1075 Update the amount of collateral for a Derivative position see 1076 https://docs.bitfinex.com/reference#rest-auth-deriv-pos-collateral-set for more 1077 info 1078 1079 #### func (*WalletService) Transfer 1080 1081 ```go 1082 func (ws *WalletService) Transfer(from, to, currency, currencyTo string, amount float64) (*notification.Notification, error) 1083 ``` 1084 Submits a request to transfer funds from one Bitfinex wallet to another see 1085 https://docs.bitfinex.com/reference#transfer-between-wallets for more info 1086 1087 #### func (*WalletService) Wallet 1088 1089 ```go 1090 func (s *WalletService) Wallet() (*wallet.Snapshot, error) 1091 ``` 1092 Retrieves all of the wallets for the account see 1093 https://docs.bitfinex.com/reference#rest-auth-wallets for more info 1094 1095 #### func (*WalletService) Withdraw 1096 1097 ```go 1098 func (ws *WalletService) Withdraw(wallet, method string, amount float64, address string) (*notification.Notification, error) 1099 ``` 1100 Submits a request to withdraw funds from the given Bitfinex wallet to the given 1101 address See https://docs.bitfinex.com/reference#withdraw for more info