mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 23:16: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:
@@ -1,5 +1,6 @@
|
||||
exch := import("exchange")
|
||||
t := import("times")
|
||||
fmt := import("fmt")
|
||||
// Import all the indicators you want
|
||||
atr := import("indicator/atr")
|
||||
sma := import("indicator/sma")
|
||||
@@ -12,7 +13,12 @@ load := func() {
|
||||
end := t.add_date(start, 0, 6 , 0)
|
||||
|
||||
// This fetches the ohlcv
|
||||
ohlcvData := exch.ohlcv("binance", "BTC-USDT", "-", "SPOT", start, end, "1d")
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
ohlcvData := exch.ohlcv(ctx, "binance", "BTC-USDT", "-", "SPOT", start, end, "1d")
|
||||
if is_error(ohlcvData) {
|
||||
fmt.println(ohlcvData)
|
||||
return
|
||||
}
|
||||
|
||||
// construct ta values
|
||||
avgtr := atr.calculate(ohlcvData.candles, 14)
|
||||
@@ -22,7 +28,14 @@ load := func() {
|
||||
// 'ctx' is already defined when we construct our bytecode from file.
|
||||
// It contains script ID and shortname of file as save details to default
|
||||
// script output directory.
|
||||
// To add debugging information to the request, see verbose.gct. To add account credentials, see account.gct
|
||||
common.writeascsv(ctx, ohlcvData, avgtr, simma, expma)
|
||||
|
||||
// A custom filename can also be declared when using a string instead of the
|
||||
// context variable like below. This will continue to save in the output
|
||||
// folder of the scripts file and will look something like this
|
||||
// 'super_cool_filename-1658465844999067400.csv'.
|
||||
// common.writeascsv("super_cool_filename", ohlcvData, avgtr, simma, expma)
|
||||
}
|
||||
|
||||
load()
|
||||
Reference in New Issue
Block a user