Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Maker only mode #101

Merged
merged 30 commits into from
Feb 5, 2019
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2a9f13e
1 - added support for submit mode
nikhilsaraf Jan 16, 2019
ce30d6b
2 - framework support for submit filters
nikhilsaraf Jan 16, 2019
14b4390
t - started implementing sdex filter
nikhilsaraf Jan 17, 2019
68efa68
A - started actual logic of maker mode
nikhilsaraf Jan 18, 2019
51535dc
B
nikhilsaraf Jan 19, 2019
9e53a0c
C
nikhilsaraf Jan 19, 2019
246c9b5
D - untested impl. of shouldKeepOfferMakerMode using topBid/topAsk pr…
nikhilsaraf Jan 23, 2019
f71861d
E - temp refactored to accommodate for transformOfferTakerMode
nikhilsaraf Jan 23, 2019
d4e4666
F only do maker_only mode for now
nikhilsaraf Jan 24, 2019
d87971b
G - convert ops to dropped state (modify to delete op etc.)
nikhilsaraf Jan 24, 2019
cda3a26
H - fix keep logic to count dropped correctly, actually return filter…
nikhilsaraf Jan 24, 2019
6d99478
fix usage of deleteAllOffersAndExit in trade.go
nikhilsaraf Jan 31, 2019
bd79d18
TODO testing
nikhilsaraf Jan 24, 2019
fd90938
fix TODO price when logging
nikhilsaraf Jan 31, 2019
8b73354
incorporate get orderbook call into submitMode's sdexMaker filter
nikhilsaraf Jan 31, 2019
5bbd9ee
default submitMode to empty string
nikhilsaraf Jan 31, 2019
72b2db5
remove numDropped var
nikhilsaraf Jan 31, 2019
6da6162
Revert "remove numDropped var"
nikhilsaraf Jan 31, 2019
7b38d7a
count numTransformed ops, including in list of ops to be submitted
nikhilsaraf Jan 31, 2019
5c96250
log num kept ops
nikhilsaraf Jan 31, 2019
f451ca5
1
nikhilsaraf Jan 31, 2019
cf5262f
2
nikhilsaraf Jan 31, 2019
0694fbd
3 - remove redundant trading account
nikhilsaraf Feb 1, 2019
ecf92e3
4 - untested logic for getting top price excluding trader's offers
nikhilsaraf Feb 1, 2019
2382ac3
5 - log keep value
nikhilsaraf Feb 2, 2019
9cc1a87
6 cleanup
nikhilsaraf Feb 2, 2019
c372fca
7 - cleanup logging of sdexMakerFilter
nikhilsaraf Feb 2, 2019
556c158
8 - new files
nikhilsaraf Feb 2, 2019
6c41262
9 remove TODOs
nikhilsaraf Feb 2, 2019
9c3dade
10 resolve compile errors after moving to api/plugins
nikhilsaraf Feb 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
1 - added support for submit mode
nikhilsaraf committed Jan 31, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 2a9f13e0d62e45846116a2440aa2f6e16a3503ee
2 changes: 2 additions & 0 deletions cmd/trade.go
Original file line number Diff line number Diff line change
@@ -181,6 +181,7 @@ func init() {
deleteAllOffersAndExit(l, botConfig, client, sdex)
}

submitMode := trader.ParseSubmitMode(botConfig.SubmitMode)
timeController := plugins.MakeIntervalTimeController(
time.Duration(botConfig.TickIntervalSeconds)*time.Second,
botConfig.MaxTickDelayMillis,
@@ -194,6 +195,7 @@ func init() {
strat,
timeController,
botConfig.DeleteCyclesThreshold,
submitMode,
threadTracker,
fixedIterations,
dataKey,
3 changes: 3 additions & 0 deletions examples/configs/trader/sample_trader.cfg
Original file line number Diff line number Diff line change
@@ -20,6 +20,9 @@ TICK_INTERVAL_SECONDS=300
# randomized interval delay in millis
MAX_TICK_DELAY_MILLIS=0

# the mode to use when submitting - maker_only, taker_only, both (default)
SUBMIT_MODE="both"

# how many continuous errors in each update cycle can the bot accept before it will delete all offers to protect its exposure.
# this number has to be exceeded for all the offers to be deleted and any error will be counted only once per update cycle.
# any time the bot completes a full run successfully this counter will be reset.
1 change: 1 addition & 0 deletions trader/config.go
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ type BotConfig struct {
TickIntervalSeconds int32 `valid:"-" toml:"TICK_INTERVAL_SECONDS"`
MaxTickDelayMillis int64 `valid:"-" toml:"MAX_TICK_DELAY_MILLIS"`
DeleteCyclesThreshold int64 `valid:"-" toml:"DELETE_CYCLES_THRESHOLD"`
SubmitMode string `valid:"-" toml:"SUBMIT_MODE"`
FillTrackerSleepMillis uint32 `valid:"-" toml:"FILL_TRACKER_SLEEP_MILLIS"`
HorizonURL string `valid:"-" toml:"HORIZON_URL"`
AlertType string `valid:"-" toml:"ALERT_TYPE"`
24 changes: 24 additions & 0 deletions trader/submitMode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package trader

// SubmitMode is the type of mode to be used when submitting orders to the trader bot
type SubmitMode uint8

// constants for the SubmitMode
const (
SubmitModeMakerOnly SubmitMode = iota
SubmitModeTakerOnly
SubmitModeBoth
)

// ParseSubmitMode converts a string to the SubmitMode constant
func ParseSubmitMode(submitMode string) SubmitMode {
if submitMode == "maker_only" {
return SubmitModeMakerOnly
}

if submitMode == "taker_only" {
return SubmitModeTakerOnly
}

return SubmitModeBoth
}
3 changes: 3 additions & 0 deletions trader/trader.go
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ type Trader struct {
strat api.Strategy // the instance of this bot is bound to this strategy
timeController api.TimeController
deleteCyclesThreshold int64
submitMode SubmitMode
threadTracker *multithreading.ThreadTracker
fixedIterations *uint64
dataKey *model.BotKey
@@ -55,6 +56,7 @@ func MakeBot(
strat api.Strategy,
timeController api.TimeController,
deleteCyclesThreshold int64,
submitMode SubmitMode,
threadTracker *multithreading.ThreadTracker,
fixedIterations *uint64,
dataKey *model.BotKey,
@@ -69,6 +71,7 @@ func MakeBot(
strat: strat,
timeController: timeController,
deleteCyclesThreshold: deleteCyclesThreshold,
submitMode: submitMode,
threadTracker: threadTracker,
fixedIterations: fixedIterations,
dataKey: dataKey,