improve trading signals
This commit is contained in:
@ -523,7 +523,7 @@ class DQNAgent:
|
||||
self.position_entry_time = time.time()
|
||||
logger.info(f"ENTERING SHORT position at {current_price:.4f} with confidence {dominant_confidence:.4f}")
|
||||
return 0
|
||||
else:
|
||||
else:
|
||||
# Not confident enough to enter position
|
||||
return None
|
||||
|
||||
@ -544,7 +544,7 @@ class DQNAgent:
|
||||
self.position_entry_price = current_price
|
||||
self.position_entry_time = time.time()
|
||||
return 0
|
||||
else:
|
||||
else:
|
||||
# Hold the long position
|
||||
return None
|
||||
|
||||
@ -565,7 +565,7 @@ class DQNAgent:
|
||||
self.position_entry_price = current_price
|
||||
self.position_entry_time = time.time()
|
||||
return 1
|
||||
else:
|
||||
else:
|
||||
# Hold the short position
|
||||
return None
|
||||
|
||||
@ -1260,4 +1260,11 @@ class DQNAgent:
|
||||
'use_prioritized_replay': self.use_prioritized_replay,
|
||||
'gradient_clip_norm': self.gradient_clip_norm,
|
||||
'target_update_frequency': self.target_update_freq
|
||||
}
|
||||
}
|
||||
|
||||
def get_params_count(self):
|
||||
"""Get total number of parameters in the DQN model"""
|
||||
total_params = 0
|
||||
for param in self.policy_net.parameters():
|
||||
total_params += param.numel()
|
||||
return total_params
|
Reference in New Issue
Block a user