fix(csv): record trade to seperate file for each config
This commit is contained in:
		
							
								
								
									
										5
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								main.py
									
									
									
									
									
								
							@@ -124,11 +124,11 @@ class MexcSpotTrade:
 | 
			
		||||
        "FILL_OR_KILL": ["quantity", "price"],
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def __init__(self, config, symbol_mapping):
 | 
			
		||||
    def __init__(self, config, symbol_mapping, config_file_name):
 | 
			
		||||
        """初始化交易机器人"""
 | 
			
		||||
        self.trader = mexc_spot_v3.mexc_trade(config)
 | 
			
		||||
        self.market = MexcSpotMarket(config)
 | 
			
		||||
        self.csv_file = "output/mexc_spot_trade.csv"
 | 
			
		||||
        self.csv_file = f"output/{config_file_name}.csv"
 | 
			
		||||
        self.symbol_mapping = symbol_mapping
 | 
			
		||||
 | 
			
		||||
    def _api_get_order(self, symbol: str, order_id: str) -> Optional[Dict[str, Any]]:
 | 
			
		||||
@@ -509,6 +509,7 @@ def main():
 | 
			
		||||
            spot_trader = MexcSpotTrade(
 | 
			
		||||
                config.config_data.get("api", {}),
 | 
			
		||||
                config.config_data.get("symbol_mapping", {}),
 | 
			
		||||
                os.path.basename(config_file).replace('.json', '')
 | 
			
		||||
            )
 | 
			
		||||
            today_trades = config.get_today_trades()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user