'I Made Tow function in pymongo but the out but that i want is different from i get from the function any ideas how can i fix it?
Funtion that save Close,Symbol, Timeframe
def Save_(self,collection,symbol,price,TF):
db = self.get_db('MTF')[collection]
B = {'ts':time.time(),"Symbol":symbol,
"Price":price,'TimeFrame':TF}
data = db.insert_one(B)
return data
Function to get data from mongodb
def find_all(self,collection):
db = self.get_db('MTF')[collection]
Symbols ={}
data = db.find({})
for i in data:
Symbols[i['Symbol']] = [i['Price'],i['TimeFrame']]
return Symbols
images from mongodb [2]: https://i.stack.imgur.com/RLtnz.png
images from B Function [1]: https://i.stack.imgur.com/AtwSy.png
if u see the image from Function B only gave me on timeframe but Function Save have 4 timeframe
Solution 1:[1]
email is declared with char email[USR_LEN]; and USR_LEN is 16, but it is read with fscanf(stdin, "%31s", email);.
Also, the results of fscanf are not tested. The user can use Control-D (on Unix) to cause no input, leaving the buffers uninitialized, and then strcmp can overrun a buffer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eric Postpischil |
