Skip to content

Commit

Permalink
Update automatic-indicator.php
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMelchin authored Oct 8, 2024
1 parent c836270 commit d5ed038
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Resources/option-indicators/automatic-indicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@

# Group the contracts into call/put pairs.
contracts_pair_sizes = chain.groupby(['expiry', 'strike']).count()['right']
missing_contracts = contracts_pair_sizes[contracts_pair_sizes < 2].index
paired_contracts = contracts_pair_sizes[contracts_pair_sizes == 2].index
symbols = chain[
chain['expiry'].isin(missing_contracts.levels[0]) &
chain['strike'].isin(missing_contracts.levels[1])
chain['expiry'].isin(paired_contracts.levels[0]) &
chain['strike'].isin(paired_contracts.levels[1])
].reset_index().groupby(['expiry', 'strike', 'right', 'symbol']).first().index.levels[-1]
pairs = [(symbols[i], symbols[i+1]) for i in range(0, len(symbols), 2)]

Expand Down

0 comments on commit d5ed038

Please sign in to comment.