Skip to content

Commit

Permalink
feat: make limit order stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Primexz committed May 17, 2024
1 parent 5090b37 commit 1633982
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This tool is configured via environment variables. Some environment variables ar
| `KRAKEN_PRIVATE_KEY` | Your Kraken API private key || |
| `CURRENCY` | Your fiat currency to be used, e.g. USD or EUR || `USD` |
| `KRAKEN_ORDER_SIZE` | The order size to be used. This value should only be edited if you know exactly what you are doing. || `0.0001` |
| `EXPERIMENTAL_MAKER_FEE` | If set to true, limit orders are placed. With a normal monthly volume, you only pay 0.25% fees per purchase instead of 0.4%. **Warning: This feature is experimental.** || `false` |
| `LIMIT_ORDER_MODE` | If set to true, limit orders are placed. With a normal monthly volume, you only pay 0.25% fees per purchase instead of 0.4%. || `false` |
| `CHECK_DELAY` | How often the algorithm should be executed, in seconds. || `60` |
| `GOTIFY_URL` | URL to your Gotify server || |
| `GOTIFY_APP_TOKEN` | App token for the app on the Gotify server || |
Expand Down
18 changes: 9 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
)

var (
KrakenPublicKey string
KrakenPrivateKey string
Currency string
KrakenOrderSize float64
CheckDelay float64
CryptoPrefix string
FiatPrefix string
ExperimentalMakerFee bool
KrakenPublicKey string
KrakenPrivateKey string
Currency string
KrakenOrderSize float64
CheckDelay float64
CryptoPrefix string
FiatPrefix string
LimitOrderMode bool
)

var logger = log.WithFields(log.Fields{
Expand All @@ -30,7 +30,7 @@ func LoadConfiguration() {
Currency = loadFallbackEnvVariable("CURRENCY", "USD")
KrakenOrderSize = loadFloatEnvVariableWithFallback("KRAKEN_ORDER_SIZE", 0.0001) // https://support.kraken.com/hc/en-us/articles/205893708-Minimum-order-size-volume-for-trading
CheckDelay = loadFloatEnvVariableWithFallback("CHECK_DELAY", 60)
ExperimentalMakerFee = loadBoolEnvVariableWithFallback("EXPERIMENTAL_MAKER_FEE", false)
LimitOrderMode = loadBoolEnvVariableWithFallback("LIMIT_ORDER_MODE", false)

if Currency == "USD" || Currency == "EUR" || Currency == "GBP" {
CryptoPrefix = "X"
Expand Down
2 changes: 1 addition & 1 deletion kraken/purchase.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k *KrakenApi) BuyBtc(_retry_do_not_use int) {
krakenErr error
)

if config.ExperimentalMakerFee {
if config.LimitOrderMode {
priceRound, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", fiatPrice), 64)
args := map[string]interface{}{
// if set to true, no order will be submitted
Expand Down
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ func main() {

config.LoadConfiguration()

if config.ExperimentalMakerFee {
log.Warn("Experimental maker fee is enabled. This feature is not recommended for production use.")
}

bot.NewBot().StartBot()

select {}
Expand Down

0 comments on commit 1633982

Please sign in to comment.