Skip to content

Commit

Permalink
Add downloads badge
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Jun 29, 2021
1 parent 5dabfe7 commit ce4bb45
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# [finmarketpy (formerly pythalesians)](https://github.com/cuemacro/finmarketpy)

[![Downloads](https://pepy.tech/badge/finmarketpy)](https://pepy.tech/project/finmarketpy)

finmarketpy is a Python based library that enables you to analyze market data and also to backtest trading strategies using
a simple to use API, which has prebuilt templates for you to define backtest. Included in the library

Expand Down
25 changes: 25 additions & 0 deletions finmarketpy_examples/fx_options_pricing_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,28 @@
# TODO: calendar around election results in slightly different pricing
# print(fx_op.price_instrument(cross, pd.Timestamp(horizon_date), '25d-otm', contract_type='european-put', tenor='1W').to_string())
# print(fx_op.price_instrument(cross, pd.Timestamp(horizon_date), 3.5724, contract_type='european-put', expiry_date=pd.Timestamp('2 Nov 2018')).to_string())

###### Price GBPUSD option around Brexit with unquoted deltas
if run_example == 8 or run_example == 0:

horizon_date = '23 Jun 2016'
cross = 'GBPUSD'

# Download the whole all market data for GBPUSD for pricing options (vol surface)
md_request = MarketDataRequest(start_date=horizon_date, finish_date=horizon_date,
data_source='bloomberg', cut='NYC', category='fx-vol-market',
tickers=cross, base_depos_currencies=[cross[0:3], cross[3:6]],
cache_algo='cache_algo_return')

df = market.fetch_market(md_request)

fx_vol_surface = FXVolSurface(market_df=df, asset=cross)

fx_op = FXOptionsPricer(fx_vol_surface=fx_vol_surface)

# Price several different options
print("atm 1M european call")
print(fx_op.price_instrument(cross, pd.Timestamp(horizon_date), 'atm', contract_type='european-call', tenor='1M').to_string())

print("25d 1W european put")
print(fx_op.price_instrument(cross, pd.Timestamp(horizon_date), '25d-otm', contract_type='european-put', tenor='1W').to_string())

0 comments on commit ce4bb45

Please sign in to comment.