Skip to content

Commit a65215c

Browse files
updates
1 parent 35149e9 commit a65215c

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

trading_api/classes/orders_classes.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ class OrdersOutput(OrdersInput):
5353
...,
5454
description='Unique identifier for the order',
5555
)
56-
status: str = Field(
57-
...,
58-
description='Status of the order',
59-
)
56+
status: OrderStatus = Field(..., description='Status of the order')
6057

6158

6259
class Order(SQLModel, table=True):
@@ -73,7 +70,7 @@ class Order(SQLModel, table=True):
7370
id: int = sqlField(default=None, primary_key=True)
7471
stocks: str = sqlField(..., description="Currency pair symbol (e.g., 'EURUSD')")
7572
quantity: float = sqlField(..., description="Quantity of the currency pair to be traded", ge=0)
76-
status: OrderStatus = sqlField(default=OrderStatus.PENDING, description="Status of the order")
73+
status: OrderStatus = sqlField(default=OrderStatus.PENDING, sa_column_kwargs={"server_default": OrderStatus.PENDING.name}, description="Status of the order")
7774
__table_args__ = (
7875
Index("idx_status", "status"),
79-
)
76+
)

trading_api/internal/database.db

8 KB
Binary file not shown.

trading_api/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from trading_api.routers import orders
1010

1111
API_DESCRIPTION = """
12-
A RESTful API to simulate a Forex trading platform with WebSocket support for real-time order updates.
12+
A RESTful API designed to simulate a Forex trading platform for creating, retrieving, and deleting orders.
13+
When an order is created, it is initially assigned the status "pending".
14+
Over time, the order's status is automatically and randomly updated to either "executed" or "canceled", reflecting the dynamic nature of real-world trading.
1315
"""
1416

1517
app = FastAPI(

0 commit comments

Comments
 (0)