skyffire 5 months ago
parent
commit
23c5dcf360
1 changed files with 9 additions and 9 deletions
  1. 9 9
      price_checker.py

+ 9 - 9
price_checker.py

@@ -12,21 +12,21 @@ import plotly.graph_objects as go
 from plotly.utils import PlotlyJSONEncoder
 
 # --- 配置部分 ---
-IN_TOKEN_ADDRESS_SOLANA = 'So11111111111111111111111111111111111111112'
-OUT_TOKEN_ADDRESS_SOLANA = 'ED5nyyWEzpPPiWimP8vYm7sD7TD3LAt3Q3gRTWHzPJBY'
-AMOUNT_TO_QUERY_OPENOCEAN_IN_SOL = decimal.Decimal('10')
-GATEIO_SPOT_PAIR_RFC_USDT = 'MOODENG_USDT'
-BINANCE_SOL_USDT_PAIR = 'SOLUSDT'
+IN_TOKEN_ADDRESS_SOLANA = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
+OUT_TOKEN_ADDRESS_SOLANA = '0x28561B8A2360F463011c16b6Cc0B0cbEF8dbBcad'
+AMOUNT_TO_QUERY_OPENOCEAN_IN_SOL = decimal.Decimal('1')
+GATEIO_SPOT_PAIR_RFC_USDT = 'MOODENGETH_USDT'
+BINANCE_SOL_USDT_PAIR = 'ETHUSDT'
 proxies = None
 decimal.getcontext().prec = 36
 
 
 # --- 价格获取函数 (与上一版相同,此处省略以保持简洁) ---
-def get_openocean_price_solana(in_token_addr, out_token_addr, human_amount_in_decimal_for_request):
-    chain = 'solana';
+def get_openocean_price_eth(in_token_addr, out_token_addr, human_amount_in_decimal_for_request):
+    chain = 'eth';
     url = f'https://open-api.openocean.finance/v4/{chain}/quote'
     params = {'inTokenAddress': in_token_addr, 'outTokenAddress': out_token_addr,
-              'amount': str(human_amount_in_decimal_for_request), 'gasPrice': '0.000005'}
+              'amount': str(human_amount_in_decimal_for_request), 'gasPrice': '5000000000'}
     try:
         r = requests.get(url, params=params, proxies=proxies, timeout=10);
         r.raise_for_status();
@@ -124,7 +124,7 @@ def update_data_for_plotly_and_table():
     while True:
         fetch_time_full = time.strftime("%Y-%m-%d %H:%M:%S");
         fetch_time_chart = time.strftime("%H:%M:%S")
-        oo_data = get_openocean_price_solana(IN_TOKEN_ADDRESS_SOLANA, OUT_TOKEN_ADDRESS_SOLANA,
+        oo_data = get_openocean_price_eth(IN_TOKEN_ADDRESS_SOLANA, OUT_TOKEN_ADDRESS_SOLANA,
                                              AMOUNT_TO_QUERY_OPENOCEAN_IN_SOL)
         spot_usdt_data = get_gateio_spot_price_usdt(GATEIO_SPOT_PAIR_RFC_USDT)
         binance_sol_usdt_data = get_binance_spot_price_usdt(BINANCE_SOL_USDT_PAIR)