Spaces:
Running
Running
Bhanu Prasanna
commited on
Commit
•
33d57b4
1
Parent(s):
c6cc681
Update
Browse files
.gitignore
CHANGED
@@ -5,3 +5,4 @@
|
|
5 |
*.ali
|
6 |
*.idea
|
7 |
*app.py
|
|
|
|
5 |
*.ali
|
6 |
*.idea
|
7 |
*app.py
|
8 |
+
*.env
|
main.py
CHANGED
@@ -7,6 +7,7 @@ import streamlit as st
|
|
7 |
from utilities.py.styling import streamlit_style
|
8 |
from utilities.py import plots
|
9 |
from utilities.py import summary_tables
|
|
|
10 |
|
11 |
from pypfopt import EfficientFrontier
|
12 |
from pypfopt import risk_models
|
@@ -250,3 +251,5 @@ if number_of_symbols > 1:
|
|
250 |
|
251 |
st.write("Montly Return")
|
252 |
st.dataframe(merged_monthly_returns_data, use_container_width=True)
|
|
|
|
|
|
7 |
from utilities.py.styling import streamlit_style
|
8 |
from utilities.py import plots
|
9 |
from utilities.py import summary_tables
|
10 |
+
from utilities.py import mongodb
|
11 |
|
12 |
from pypfopt import EfficientFrontier
|
13 |
from pypfopt import risk_models
|
|
|
251 |
|
252 |
st.write("Montly Return")
|
253 |
st.dataframe(merged_monthly_returns_data, use_container_width=True)
|
254 |
+
|
255 |
+
mongodb.mongodb_push_data(company_name_to_symbol, number_of_symbols)
|
utilities/py/__pycache__/mongodb.cpython-310.pyc
ADDED
Binary file (699 Bytes). View file
|
|
utilities/py/__pycache__/plots.cpython-310.pyc
CHANGED
Binary files a/utilities/py/__pycache__/plots.cpython-310.pyc and b/utilities/py/__pycache__/plots.cpython-310.pyc differ
|
|
utilities/py/__pycache__/styling.cpython-310.pyc
CHANGED
Binary files a/utilities/py/__pycache__/styling.cpython-310.pyc and b/utilities/py/__pycache__/styling.cpython-310.pyc differ
|
|
utilities/py/__pycache__/summary_tables.cpython-310.pyc
CHANGED
Binary files a/utilities/py/__pycache__/summary_tables.cpython-310.pyc and b/utilities/py/__pycache__/summary_tables.cpython-310.pyc differ
|
|
utilities/py/mongodb.py
CHANGED
@@ -3,27 +3,36 @@ import socket
|
|
3 |
from dotenv import load_dotenv
|
4 |
import os
|
5 |
import urllib
|
|
|
6 |
|
7 |
load_dotenv()
|
8 |
-
|
|
|
|
|
|
|
9 |
username = urllib.parse.quote_plus(os.environ.get("USERNAME"))
|
10 |
password = urllib.parse.quote_plus(os.environ.get("PASSWORD"))
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
client = MongoClient
|
15 |
-
if "capiport" in client.
|
16 |
-
|
17 |
-
else:
|
18 |
-
|
19 |
-
collection = db
|
20 |
-
hostname = socket.gethostname()
|
21 |
-
ip_address = socket.
|
22 |
-
data = {
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
}
|
28 |
-
collection.
|
29 |
-
client.
|
|
|
3 |
from dotenv import load_dotenv
|
4 |
import os
|
5 |
import urllib
|
6 |
+
import streamlit as st
|
7 |
|
8 |
load_dotenv()
|
9 |
+
|
10 |
+
|
11 |
+
def mongodb_push_data(company_name_to_symbol, number_of_symbols):
|
12 |
+
|
13 |
username = urllib.parse.quote_plus(os.environ.get("USERNAME"))
|
14 |
password = urllib.parse.quote_plus(os.environ.get("PASSWORD"))
|
15 |
+
# client = "mongodb+srv://bhanuprasanna:<password>@capiport.xtnx5it.mongodb.net/"
|
16 |
+
MONGO_DB_URI = "mongodb+srv://%s:%s@capiport.xtnx5it.mongodb.net/" % (
|
17 |
+
username,
|
18 |
+
password,
|
19 |
+
)
|
20 |
|
21 |
+
st.write(MONGO_DB_URI)
|
22 |
|
23 |
+
# client = MongoClient(MONGO_DB_URI)
|
24 |
+
# if "capiport" in client.list_database_names():
|
25 |
+
# db = client["capiport"]
|
26 |
+
# else:
|
27 |
+
# db = client["capiport"]
|
28 |
+
# collection = db["stocks they picked"]
|
29 |
+
# hostname = socket.gethostname()
|
30 |
+
# ip_address = socket.gethostbyname(hostname)
|
31 |
+
# data = {
|
32 |
+
# "hostname": hostname,
|
33 |
+
# "stocks_picked": company_name_to_symbol,
|
34 |
+
# "number_of_stocks_picked": number_of_symbols,
|
35 |
+
# "ip_address": ip_address,
|
36 |
+
# }
|
37 |
+
# collection.insert_one(data)
|
38 |
+
# client.close()
|