Skip to content

Commit dd57f24

Browse files
committed
Change trade id to uuid for traceability
1 parent 5690bd3 commit dd57f24

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

investing_algorithm_framework/services/backtesting/backtest_service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from collections import defaultdict
55
from datetime import datetime, timedelta, timezone
66
from typing import Dict, List, Union
7+
from uuid import uuid4
78

89
import numpy as np
910
import pandas as pd
@@ -124,6 +125,8 @@ def create_vector_backtest(
124125
strategy: The strategy to backtest.
125126
backtest_date_range: The date range for the backtest.
126127
initial_amount: The initial amount to use for the backtest.
128+
risk_free_rate: The risk-free rate to use for the backtest
129+
metrics. Default is 0.027 (2.7%).
127130
128131
Returns:
129132
BacktestRun: The backtest run containing the results and metrics.
@@ -257,7 +260,7 @@ def create_vector_backtest(
257260
if current_signal == 1 and last_trade is None:
258261
amount = float(capital_for_trade / current_price)
259262
order = Order(
260-
id=len(orders) + 1,
263+
id=uuid4(),
261264
target_symbol=symbol,
262265
trading_symbol=trading_symbol,
263266
order_type=OrderType.LIMIT,

0 commit comments

Comments
 (0)