Skip to content

Commit

Permalink
Merge pull request #13 from QuantConnect/bug-foundation-update
Browse files Browse the repository at this point in the history
Fix after dependency update
  • Loading branch information
Martin-Molinero authored Mar 2, 2023
2 parents 1787431 + 5213438 commit 6da8408
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
35 changes: 18 additions & 17 deletions DataProcessing/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,30 +210,31 @@ def try_create_figi_map(self):
self.figi_map = {}

db_connection = sqlalchemy.create_engine(self.db_connection_info)
df = pd.read_sql(f'SELECT figi, sid, ticker FROM {self.db_security_table} ORDER BY id DESC', con=db_connection)
with db_connection.connect() as connection:
df = pd.DataFrame(connection.execute(sqlalchemy.text(f'SELECT figi, sid, ticker FROM {self.db_security_table} ORDER BY id DESC')))

if df.empty:
print('Database contains no FIGI/ticker entries')
return False
if df.empty:
print('Database contains no FIGI/ticker entries')
return False

df = df.drop_duplicates(subset='figi')
df = df.drop_duplicates(subset='figi')

for _, secdef in df.iterrows():
figi = secdef['figi']
sid = secdef['sid']
for _, secdef in df.iterrows():
figi = secdef['figi']
sid = secdef['sid']

if not figi or figi.isspace():
continue
if not figi or figi.isspace():
continue

if not sid or sid.isspace():
continue
if not sid or sid.isspace():
continue

try:
self.figi_map[figi] = SecurityIdentifier.Parse(sid)
except:
print(f'Failed to parse SID: {sid} for Security: {figi}')
try:
self.figi_map[figi] = SecurityIdentifier.Parse(sid)
except:
print(f'Failed to parse SID: {sid} for Security: {figi}')

return any(self.figi_map)
return any(self.figi_map)

def parse_raw(self, file, category, date, lookback_days=None):
columns = list(self.category_parsing_columns[category]) + ['COMPOSITE_FIGI']
Expand Down
2 changes: 1 addition & 1 deletion QuantConnect.DataSource.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="QuantConnect.Common" Version="2.5.*" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 6da8408

Please sign in to comment.