Skip to content

Commit

Permalink
Refactor: Coinbase authentication (#492)
Browse files Browse the repository at this point in the history
* fix: replace py escape character to general one

* feat: new auth key of Cinbase in Readme

* feat: add comment why we should use replace in value configuration
  • Loading branch information
Romazes authored Aug 21, 2024
1 parent 5118352 commit 01b9d4e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down Expand Up @@ -345,8 +346,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down Expand Up @@ -841,8 +843,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down Expand Up @@ -1265,8 +1268,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down Expand Up @@ -1710,8 +1714,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down Expand Up @@ -1881,8 +1886,9 @@ Options:
The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
--bitfinex-api-key TEXT Your Bitfinex API key
--bitfinex-api-secret TEXT Your Bitfinex API secret
--coinbase-api-key TEXT Your Coinbase Advanced Trade API key
--coinbase-api-secret TEXT Your Coinbase Advanced Trade API secret
--coinbase-api-name TEXT Your Coinbase Advanced Trade API name from file.
--coinbase-api-private-key TEXT
Your Coinbase Advanced Trade API private key from file.
--binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
--binance-api-key TEXT Your Binance API key
Expand Down
9 changes: 8 additions & 1 deletion lean/models/json_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ def get_settings(self) -> Dict[str, str]:
for key, value in configuration._value.items():
settings[key] = str(value)
else:
settings[configuration._id] = str(configuration._value).replace("\\", "/")
# Replace escaped newline characters and backslashes in the configuration value.
# When reading the JSON configuration through Python, newline characters ('\n') and backslashes ('\')
# may be escaped, causing issues in scenarios where these characters are expected to be interpreted
# literally (e.g., file paths, multi-line strings). This replace operation ensures that:
# 1. Escaped newline characters ('\\n') are correctly interpreted as actual newlines ('\n').
# 2. Backslashes ('\\') in file paths are converted to forward slashes ('/'), making paths
# more consistent across different operating systems.
settings[configuration._id] = str(configuration._value).replace("\\n", "\n").replace("\\", "/")

return settings

Expand Down

0 comments on commit 01b9d4e

Please sign in to comment.