Compare commits
2 Commits
73d3a6145a
...
03ef60b303
Author | SHA1 | Date | |
---|---|---|---|
03ef60b303 | |||
61811a97a9 |
28
slippage_analysis.py
Normal file
28
slippage_analysis.py
Normal file
@ -0,0 +1,28 @@
|
||||
import datetime
|
||||
|
||||
from database.trades import trades
|
||||
|
||||
def average_slippage(date: datetime):
|
||||
trade_records = trades(date)
|
||||
|
||||
slippages = []
|
||||
for spreads in trade_records['Spreads']:
|
||||
for spread in spreads:
|
||||
if 'Entry Slippage' in spread:
|
||||
slippages.append(spread['Entry Slippage'])
|
||||
|
||||
if slippages:
|
||||
average_slippage = sum(slippages) / len(slippages)
|
||||
return average_slippage
|
||||
else:
|
||||
return None
|
||||
|
||||
if __name__ == "__main__":
|
||||
target_date = datetime.date(2024, 2, 23)
|
||||
|
||||
average_slippage = average_slippage(target_date)
|
||||
|
||||
if average_slippage is not None:
|
||||
print(f"{target_date} Average Entry Slippage: {average_slippage}")
|
||||
else:
|
||||
print(f"No trades found for {target_date}.")
|
Loading…
Reference in New Issue
Block a user