Files
gocryptotrader/exchanges/zb
Yordan Miladinov 2da239735f gctrpc/order manager: Add ModifyOrder endpoint (#724)
* gctcli: modifyorder stubs

* gctcli: add ModifyOrderRequest and ModifyOrderResponse in rpc.proto

* gctcli: regenerate rpc.pb.go after the addition of ModifyOrder structs

* gctrpc: add ModifyOrder() and regenerate dependent files

* gctcli: modifyorder command now uses newly generated ModifyOrder() RPC

* exchanges/order/orders.go: use time.Time.Equal() instead of ==

* gctrpc: update ModifyOrderRequest and ModifyResponse and regenerate gRPC

* gctcli/commands: rework modifyorder

* engine: implement RPCServer.ModifyOrder

* engine: commit an initial version OrderManager.Modify(), still does not update state of managed orders

* engine: OrderManager.Modify now updates the inner state of managed orders, but introduces race conditions, needs fixes

* engine/order_manager.go: comply with golangci-lint

* gctcli: fix getOrderCommand.ArgsUsage

* gctcli: fix getModifyOrderCommand args and ArgsUsage

* engine: OrderManager.Modify() now correctly updates price of modified order

* engine: RPCServer.ModifyOrder now uses checkParams() as advised

* exchanges: (1) IBotExchange.ModifyOrder now returns a Modify struct, (2) all exchanges are updated to comply with that change

* exchanges/order: Detail.UpdateOrderFromModify also updates the ID

* engine/order_manager: add store.modifyExisting() and use it in OrderManager.Modify to update (on success) the state of the modified order

* exchanges: Bitfinex.ModifyOrder() now returns the ID in case of an error

* engine: OrdetManager.Modify() now emits an order event

* exchanges/bithumb: proper order.payment_currency key

* engine/order_manager: populate more Modify fields as they are needed by (some) exchanges, add comments

* engine: test OrderManager.Modify()

* engine: test store.modifyExisting()

* engine: write a docstring for store.modifyExisting

* engine: OrderManager.Modify() now also sets Modify.Price and Modify.Amount in case of zero values

* engine: TestOrderManager_Modify() now verify the effects of price and/or amount set to 0

* engine: OrderManger.Modify() now uses the commsManager to let observers know of errors

* engine: TestOrderManager_Modify() uses t.Fatal()

* engine: TestOrderManager_Modify() and TestStore_modifyOrder() supply t.Error() with proper messages

* exchanges/order_manager_test: fix a golangci-lint complaint

* engine/order_manager: fix an error comparison bug and simplify

* gctcli/commands: check if either price or amount is set, otherwise we would waste an API call
2021-08-06 10:09:14 +10:00
..
2021-05-31 10:17:12 +10:00

GoCryptoTrader package Zb

Build Status Software License GoDoc Coverage Status Go Report Card

This zb package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

ZB Exchange

Current Features

  • REST functions

How to enable

	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then

How to do REST public/private calls

  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var z exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "ZB" {
		z = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := z.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := z.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := z.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := z.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := z.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := z.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := z.Trade(...)
if err != nil {
	// Handle error
}

How to do LongPolling public/private calls

	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then

Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc