Skip to content

Commit

Permalink
Clean up flow control in main() use or instead of bitwise | and forma…
Browse files Browse the repository at this point in the history
…tting for readability in live_update()
  • Loading branch information
cciechad committed Apr 20, 2024
1 parent 01dbf03 commit 0eda886
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AnalyzeLots.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def main() -> None:
data: DataFrame = live_update(data, symbols)
if args.summary:
summary(data, is_long, is_short)
if args.symbol | (not args.summary):
if args.symbol or not args.summary:
by_symbol(data, symbols, is_long, is_short, args.verbose)
else:
print(f'{args.file} is not a readable file.')
Expand Down Expand Up @@ -74,8 +74,8 @@ def summary(data: DataFrame, is_long: Series, is_short: Series) -> None:

def live_update(data: DataFrame, symbols: ExtensionArray) -> DataFrame:
with Pool() as p:
data['price'] = data['symbol'].map(
{k: v for k, v in p.imap_unordered(get_price, symbols, chunksize=2)}).astype(float32)
data['price'] = data['symbol'].map({k: v for k, v in
p.imap_unordered(get_price, symbols, chunksize=2)}).astype(float32)
data['value'] = data['quantity'] * data['price']
data['gain'] = data['value'] - data['cost']
return data.drop(columns=['price'])
Expand Down

0 comments on commit 0eda886

Please sign in to comment.