mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 15:10:54 +00:00
script: implementation of error insertion on return (#986)
* exchanges/account: shift credentials to account package and segregate funds to keys * merge: fixes * linter: fix * Update exchanges/account/account.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits + protection for string panic * glorious_suggestion: add method for matching keys * linter: fix tests * account: add protected method for credentials minimizing access, display full account details to rpc. * linter: spelling kweeeeeeen * accounts/portfolio: clean/check portfolio code and quickly check balances from change. Add protected method for future matching. * accounts: theres no point in pointerising everything * linter: ok pointerise this then... * exchanges: fix regression add in little notes. * glorious: nits * Update exchanges/account/credentials.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/account/credentials_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/account/credentials_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * gloriously: fix glorious glorious test gloriously * script: initial implementation of error insertion on return * script: make script context aware(ish) and update error handle in examples * script: add tests * script: add syntax highlighting to readme * Update gctscript/vm/vm.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/vm/vm.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/examples/exchange/account_info.gct Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/examples/exchange/cancel_order.gct Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/examples/verbose.gct Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * rm: bros * scripts: handle errors in examples when they are going to use the data after fetching * linter: fix rides again * SCOTT_SPELL_CHECK_LINTER: fix * gctscript: fix tests * glorious: niiiiiiiiiiiiits * scriptmodules/gct: standardize runtime errors * Update gctscript/modules/gct/exchange.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/exchange.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/exchange.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/exchange.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update gctscript/modules/gct/gct.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits/reverts * go mod: tidy Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -4,8 +4,14 @@ fmt := import("fmt")
|
||||
exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
// retrieve account information from exchange and store in info variable
|
||||
info := exch.accountinfo("BTC Markets", "spot")
|
||||
// Retrieve account information from exchange and store in info variable
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
// for more details.
|
||||
info := exch.accountinfo(ctx, "BTC Markets", "spot")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
// print out info
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,12 @@ fmt := import("fmt")
|
||||
exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
info := exch.ordercancel("binance","13371337", "btc-usdt", "spot")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
info := exch.ordercancel(ctx, "binance","13371337", "btc-usdt", "spot")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
info := exch.depositaddress("BTC Markets", "BTC", "")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@ t := import("times")
|
||||
|
||||
load := func() {
|
||||
start := t.add(t.now(), -t.hour*24)
|
||||
ohlcvData := exch.ohlcv("coinbasepro", "BTC-USD", "-", "SPOT", start, t.now(), "1h")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
ohlcvData := exch.ohlcv(ctx, "coinbasepro", "BTC-USD", "-", "SPOT", start, t.now(), "1h")
|
||||
if is_error(ohlcvData) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(ohlcvData)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,12 @@ name := "run"
|
||||
timer := "5s"
|
||||
|
||||
load := func() {
|
||||
tx := exch.orderbook("btc markets", "btc-aud", "-", "spot")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
tx := exch.orderbook(ctx, "btc markets", "btc-aud", "-", "spot")
|
||||
if is_error(tx) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(tx)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
info := exch.pairs("BTC Markets", false, "SPOT")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@ fmt := import("fmt")
|
||||
exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
info := exch.orderquery("binance", "4491600698", "BTC-USDT", "spot")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
info := exch.orderquery(ctx, "binance", "4491600698", "BTC-USDT", "spot")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@ fmt := import("fmt")
|
||||
exch := import("exchange")
|
||||
|
||||
load := func() {
|
||||
info := exch.ordersubmit("BTC Markets","BTC-AUD","-","LIMIT","SELL",1000000, 1,"", "spot")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
info := exch.ordersubmit(ctx, "BTC Markets","BTC-AUD","-","LIMIT","SELL",1000000, 1,"", "spot")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,12 @@ name := "run"
|
||||
timer := "5s"
|
||||
|
||||
load := func() {
|
||||
tx := exch.ticker("btc markets", "btc-aud", "-", "spot")
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
tx := exch.ticker(ctx, "btc markets", "btc-aud", "-", "spot")
|
||||
if is_error(tx) {
|
||||
// handle error
|
||||
}
|
||||
fmt.println(tx)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,14 @@ load := func() {
|
||||
// 4: address tag
|
||||
// 5: amount
|
||||
// 6: fee amount
|
||||
// 7: trade password
|
||||
// 8: OTP
|
||||
// 7: description
|
||||
|
||||
info := exch.withdrawcrypto("BTC Markets","BTC", "1234562362", "1231", 1.0, 0.0, "","" )
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
info := exch.withdrawcrypto(ctx, "BTC Markets", "BTC", "1234562362", "1231", 1.0, 0.0, "")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
// print out info
|
||||
fmt.println(info)
|
||||
}
|
||||
|
||||
@@ -16,8 +16,13 @@ load := func() {
|
||||
// 7: trade password
|
||||
// 8: OTP
|
||||
|
||||
// submit request to withdraw funds
|
||||
info := exch.withdrawfiat("BTC Markets", "AUD", "hello", 1, "-")
|
||||
// Submit request to withdraw funds
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
info := exch.withdrawfiat(ctx, "BTC Markets", "AUD", "hello", 1, "-")
|
||||
if is_error(info) {
|
||||
// handle error
|
||||
}
|
||||
// print out info
|
||||
fmt.println(info)
|
||||
}
|
||||
Reference in New Issue
Block a user