11from datetime import datetime , timezone
22
3- from sqlalchemy import Column , Integer , String , DateTime , Float , Boolean
3+ from sqlalchemy import Column , Integer , String , DateTime , Boolean
44from sqlalchemy import UniqueConstraint
55from sqlalchemy .orm import relationship
66from sqlalchemy .orm import validates
77
88from investing_algorithm_framework .domain import Portfolio
9- from investing_algorithm_framework .infrastructure .database import SQLBaseModel
9+ from investing_algorithm_framework .infrastructure .database import (
10+ SQLBaseModel , SqliteDecimal
11+ )
1012from investing_algorithm_framework .infrastructure .models .model_extension \
1113 import SQLAlchemyModelExtension
1214
@@ -16,14 +18,14 @@ class SQLPortfolio(Portfolio, SQLBaseModel, SQLAlchemyModelExtension):
1618 id = Column (Integer , primary_key = True )
1719 identifier = Column (String , nullable = False , unique = True )
1820 trading_symbol = Column (String , nullable = False )
19- realized = Column (Float , nullable = False , default = 0 )
20- total_revenue = Column (Float , nullable = False , default = 0 )
21- total_cost = Column (Float , nullable = False , default = 0 )
22- total_net_gain = Column (Float , nullable = False , default = 0 )
23- total_trade_volume = Column (Float , nullable = False , default = 0 )
24- net_size = Column (Float , nullable = False , default = 0 )
25- unallocated = Column (Float , nullable = False , default = 0 )
26- initial_balance = Column (Float , nullable = True )
21+ realized = Column (SqliteDecimal () , nullable = False , default = 0 )
22+ total_revenue = Column (SqliteDecimal () , nullable = False , default = 0 )
23+ total_cost = Column (SqliteDecimal () , nullable = False , default = 0 )
24+ total_net_gain = Column (SqliteDecimal () , nullable = False , default = 0 )
25+ total_trade_volume = Column (SqliteDecimal () , nullable = False , default = 0 )
26+ net_size = Column (SqliteDecimal () , nullable = False , default = 0 )
27+ unallocated = Column (SqliteDecimal () , nullable = False , default = 0 )
28+ initial_balance = Column (SqliteDecimal () , nullable = True )
2729 market = Column (String , nullable = False )
2830 positions = relationship (
2931 "SQLPosition" ,
0 commit comments