Skip to content

Commit

Permalink
Updated scaling-bot without placing pongs (using --pong-width=0).
Browse files Browse the repository at this point in the history
████ ███  To request new features or in case this commit breaks something for you,
████ ███  please, create a new github issue with all possible information for me,
▓███▀█▄   but never share your API Keys!
▒▓██ ███
░▒▓█ ███  Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
 _______________________________
/ Hello, WORLD!                 \
|                               |
\ pssst.. 1 BTC = 41831.55 EUR. /
 -------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
  • Loading branch information
ctubio committed Sep 4, 2021
1 parent 618c757 commit 4f806db
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ K ?= K.sh
MAJOR = 0
MINOR = 6
PATCH = 4
BUILD = 25
BUILD = 26

OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\
if you hurt other living creatures, please stop; \n$\
Expand Down
8 changes: 3 additions & 5 deletions src/bin/scaling-bot/scaling-bot.data.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,16 +545,14 @@ namespace analpaper {
quote2orders(calculon.quotes.bid);
};
void scale() {
if (orders.last.filled)
if (K.arg<double>("pong-width") and orders.last.filled)
placeOrder({
orders.last.side == Side::Bid
? Side::Ask
: Side::Bid,
orders.last.side == Side::Bid
? fmax(orders.last.price + K.arg<double>("pong-width"),
levels.fairValue + K.gateway->tickPrice)
: fmin(orders.last.price - K.arg<double>("pong-width"),
levels.fairValue - K.gateway->tickPrice),
? fmax(orders.last.price + K.arg<double>("pong-width"), levels.fairValue + K.gateway->tickPrice)
: fmin(orders.last.price - K.arg<double>("pong-width"), levels.fairValue - K.gateway->tickPrice),
orders.last.filled,
Tstamp,
true,
Expand Down
9 changes: 5 additions & 4 deletions src/bin/scaling-bot/scaling-bot.main.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ScalingBot: public KryptoNinja {
{
{"order-size", "AMOUNT", "0", "set AMOUNT of size in base currency to place orders"},
{"ping-width", "AMOUNT", "0", "set AMOUNT of price width to place pings away from fair value"},
{"pong-width", "AMOUNT", "0", "set AMOUNT of price width to place pongs away from pings"},
{"pong-width", "AMOUNT", "0", "set AMOUNT of price width to place pongs away from pings,"
"\n" "or leave it empty as '0' to not place pong orders."},
{"scale-asks", "1", nullptr, "do not place pings on bid side (ping only at ask side)"},
{"scale-bids", "1", nullptr, "do not place pings on ask side (ping only at bid side)"},
{"quit-after", "NUMBER", "0", "set NUMBER of filled pings before quit"},
Expand Down Expand Up @@ -56,9 +57,9 @@ class ScalingBot: public KryptoNinja {
if (!arg<double>("ping-width"))
error("CF", "Invalid empty --ping-width value");
else log("CF", "--ping-width=", opt.str(arg<double>("ping-width")));
if (!arg<double>("pong-width"))
error("CF", "Invalid empty --pong-width value");
else log("CF", "--pong-width=", opt.str(arg<double>("pong-width")));
log("CF", "--pong-width=", opt.str(arg<double>("pong-width"))
+ (arg<double>("pong-width") ? "" : Ansi::r(COLOR_WHITE) + " (pongs disabled)")
);
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Krypto.ninja-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ js: $(KCLIENT)/.main.ts lib
$(TSC) --outDir $(KASSETS)/$@ $<
@rm -v $<
@echo $(STEP_3)
$(BROWSERIFY) $(KASSETS)/$@/$(notdir $(basename $<)).$@ > $(KASSETS)/$@/client.min.$@
$(BROWSERIFY) $(KASSETS)/$@/$(notdir $(basename $<)).$@ | uglifyjs | gzip > $(KASSETS)/$@/client.min.$@

css: www/css beacons
@echo $(STEP_4)
Expand Down
14 changes: 7 additions & 7 deletions src/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ clean:
@rm -vrf $(KBUILD)

check:
# zlib | $(V_ZLIB) | $(shell curl -s https://www.zlib.net/ChangeLog.txt | grep "Changes in " | head -n1 | cut -d' ' -f3)
# openssl | $(V_SSL) | $(shell curl -s https://www.openssl.org/news/cl$(shell curl -s https://www.openssl.org/source/ | grep "The latest stable version is " | cut -d' ' -f12 | tr -d '.').txt | grep "Changes between " | head -n1 | cut -d' ' -f4)
# curl | $(V_CURL) | $(shell curl -s https://api.github.com/repos/curl/curl/releases | grep "tag_name" | head -n1 | cut -d'-' -f2 | cut -d'"' -f1 | tr '_' '.')
# sqlite | $(V_SQL) | $(shell curl -s https://www.sqlite.org/download.html | grep "sqlite-amalgamation-" | head -n1 | cut -d'-' -f3 | cut -d'.' -f1)
# zlib | $(V_ZLIB) | $(shell curl -s https://www.zlib.net/ChangeLog.txt | grep "Changes in " | head -n1 | cut -d' ' -f3)
# openssl | $(V_SSL) | $(shell curl -s https://www.openssl.org/news/cl$(shell curl -s https://www.openssl.org/source/ | grep "The latest stable version is " | cut -d' ' -f12 | tr -d '.').txt | grep "Changes between " | head -n1 | cut -d' ' -f4)
# curl | $(V_CURL) | $(shell curl -s https://curl.se/changes.html | grep "Fixed in " | head -n1 | cut -d' ' -f4)
# sqlite | $(V_SQL) | $(shell curl -s https://www.sqlite.org/download.html | grep "sqlite-amalgamation-" | head -n1 | cut -d'-' -f3 | cut -d'.' -f1)
# ncurses | $(V_NCUR) | $(shell curl -s https://www.gnu.org/software/ncurses/ | grep "Announcing " | head -n1 | cut -d' ' -f5 | cut -d'<' -f1)
# json | $(V_JSON) | $(shell curl -s https://api.github.com/repos/nlohmann/json/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)
# catch | $(V_CATCH) | $(shell curl -s https://api.github.com/repos/catchorg/Catch2/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)
# uv | $(V_UV) | $(shell curl -s https://api.github.com/repos/libuv/libuv/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)
# json | $(V_JSON) | $(shell curl -s https://api.github.com/repos/nlohmann/json/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)
# catch | $(V_CATCH) | $(shell curl -s https://api.github.com/repos/catchorg/Catch2/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)
# uv | $(V_UV) | $(shell curl -s https://api.github.com/repos/libuv/libuv/releases | grep "tag_name" | head -n1 | cut -d'v' -f2 | cut -d'"' -f1)

zlib:
test -d $(KBUILD)/var/zlib-$(V_ZLIB) || ( \
Expand Down

0 comments on commit 4f806db

Please sign in to comment.