Spaces:
Runtime error
Runtime error
Renjith Karimattathil SASIDHARAN
commited on
Commit
·
f135978
1
Parent(s):
18c3a7a
Add only recent trades
Browse files- __pycache__/app.cpython-39.pyc +0 -0
- app.py +6 -1
__pycache__/app.cpython-39.pyc
CHANGED
Binary files a/__pycache__/app.cpython-39.pyc and b/__pycache__/app.cpython-39.pyc differ
|
|
app.py
CHANGED
@@ -3,6 +3,7 @@ import os
|
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
from pymongo import MongoClient
|
|
|
6 |
import plotly.express as px
|
7 |
import plotly.graph_objects as go
|
8 |
|
@@ -17,9 +18,13 @@ db = client['algotrading']
|
|
17 |
|
18 |
def fetch_all_strategy():
|
19 |
global db
|
|
|
20 |
orders_t = db.orders
|
21 |
-
strategies = pd.DataFrame(list(orders_t.find({}, {"strategy_id":1})))
|
|
|
|
|
22 |
return list(strategies['strategy_id'].unique())
|
|
|
23 |
|
24 |
|
25 |
def fetch_orders_for_strategy(strategy):
|
|
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
from pymongo import MongoClient
|
6 |
+
from datetime import datetime, timedelta
|
7 |
import plotly.express as px
|
8 |
import plotly.graph_objects as go
|
9 |
|
|
|
18 |
|
19 |
def fetch_all_strategy():
|
20 |
global db
|
21 |
+
delta = datetime.now() - timedelta(days=7)
|
22 |
orders_t = db.orders
|
23 |
+
strategies = pd.DataFrame(list(orders_t.find({}, {"strategy_id":1, "created_ts": 1})))
|
24 |
+
strategies['created_ts'] = pd.to_datetime(strategies['created_ts'])
|
25 |
+
strategies = strategies[~(strategies['created_ts'] < delta)]
|
26 |
return list(strategies['strategy_id'].unique())
|
27 |
+
|
28 |
|
29 |
|
30 |
def fetch_orders_for_strategy(strategy):
|