diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/insert_fx_id.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/python/insert_fx_id.py b/python/insert_fx_id.py index 82fabcd4..53ede1a3 100644 --- a/python/insert_fx_id.py +++ b/python/insert_fx_id.py @@ -115,18 +115,20 @@ def main(workdate): (dawn_trades["cp_code"] == counterparty) & (dawn_trades["fund"] == fund_code) ] - for filter_param in ( - "trade_date", - "settle_date", - "buy_currency", - "sell_currency", - "buy_amount", - "sell_amount", - ): - matching_candidates = matching_candidates.loc[ - matching_candidates[filter_param] - == getattr(row, filter_param) - ] + filters = { + "trade_date": pd.Timestamp(row.trade_date), + "settle_date": pd.Timestamp(row.settle_date), + "buy_currency": row.buy_currency, + "sell_currency": row.sell_currency, + "buy_amount": row.buy_amount, + "sell_amount": row.sell_amount, + } + matching_candidates = matching_candidates.loc[ + ( + matching_candidates[list(filters.keys())] + == pd.Series(filters) + ).all(axis=1) + ] if not matching_candidates.empty: matched_candidate = matching_candidates.iloc[0, :] with conn.cursor() as c: |
