Skip to content

Commit

Permalink
fix demo issues
Browse files Browse the repository at this point in the history
Signed-off-by: Lu Ken <[email protected]>
  • Loading branch information
kenplusplus committed Dec 30, 2024
1 parent 454d09d commit d489a81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion demo/agent/run_auto_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from gentrade.market_data.crypto import BinanceMarket
from gentrade.strategy.basic import StrategySma, StrategyWma, StrategyBb, StrategyMacd, StrategyRsi

CURR = os.path.dirname(__file__)
LOG = logging.getLogger(__name__)

# pylint: disable=unexpected-keyword-arg, global-variable-not-assigned, global-statement
Expand All @@ -48,7 +49,9 @@

def get_crypto_price(name:str, timeframe:str="1h", limit:int=100) -> bool:
name += "_usdt"
bm_inst = BinanceMarket()
cache_dir = os.getenv("GENTRADE_CACHE_DIR", os.path.join(CURR, "../../cache/"))
LOG.info("Cache Directory: %s", cache_dir)
bm_inst = BinanceMarket(cache_dir)
if not bm_inst.init():
LOG.error("Fail to create Binance instance")
return None
Expand Down
6 changes: 4 additions & 2 deletions demo/agent/run_chat_trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
API_KEY = os.environ.get("OPENAI_API_KEY", "empty")
BASE_URL = os.environ.get("OPENAI_API_URL", "https://api.openai.com/v1")
MODEL = os.environ.get("OPENAI_API_MODEL", "gpt-3.5-turbo")

CURR = os.path.dirname(__file__)
config_list= [
{
'base_url': BASE_URL,
Expand All @@ -31,7 +31,9 @@

def get_crypto_price(name:str, timeframe:str="1h", limit:int=100) -> bool:
name += "_usdt"
bm_inst = BinanceMarket()
cache_dir = os.getenv("GENTRADE_CACHE_DIR", os.path.join(CURR, "../../cache/"))
LOG.info("Cache Directory: %s", cache_dir)
bm_inst = BinanceMarket(cache_dir)
if not bm_inst.init():
LOG.error("Fail to create Binance instance")
return None
Expand Down
6 changes: 4 additions & 2 deletions demo/agent/run_get_crypto_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
API_KEY = os.environ.get("OPENAI_API_KEY", "empty")
BASE_URL = os.environ.get("OPENAI_API_URL", "https://api.openai.com/v1")
MODEL = os.environ.get("OPENAI_API_MODEL", "gpt-3.5-turbo")

CURR = os.path.dirname(__file__)
config_list= [
{
'base_url': BASE_URL,
Expand All @@ -48,7 +48,9 @@

def get_crypto_price(name:str, timeframe:str="1h", limit:int=100) -> bool:
name += "_usdt"
bm_inst = BinanceMarket()
cache_dir = os.getenv("GENTRADE_CACHE_DIR", os.path.join(CURR, "../../cache/"))
LOG.info("Cache Directory: %s", cache_dir)
bm_inst = BinanceMarket(cache_dir)
if not bm_inst.init():
LOG.error("Fail to create Binance instance")
return None
Expand Down

0 comments on commit d489a81

Please sign in to comment.