Skip to content

Commit

Permalink
fixed ticks greater than zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoiv committed Mar 11, 2024
1 parent 079c13b commit 950b537
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions backend/routers/users/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ async def start_end_tick_dep(game: Game = Depends(game_dep),
raise HTTPException(
status_code=400, detail="Game just started (it is tick=0), no data to return")

if start_tick < 0 or end_tick < 0:
raise HTTPException(
status_code=400, detail=f"Start ({start_tick}) and end ({end_tick}) tick must both be greater than 0")

if end_tick < start_tick:
raise HTTPException(
status_code=400, detail="End tick must be greater than start tick")
Expand Down
8 changes: 4 additions & 4 deletions testing/cheat_sheet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -233,25 +233,25 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 34,
"id": "838d39e0-3875-4cd3-b620-c4df377e5308",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'detail': 'Expiration tick (-541) must be in the future, current_tick (459)'}"
"1290"
]
},
"execution_count": 30,
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"algotrade_api.create_order(resource=algotrade_api.Resource.oil,\n",
" price=10, side=algotrade_api.OrderSide.BUY,\n",
" size=1, expiration_length=).json()"
" size=1, expiration_length=1).json()"
]
},
{
Expand Down

0 comments on commit 950b537

Please sign in to comment.