Skip to content

Commit

Permalink
Updated financepy version used
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Apr 5, 2022
1 parent 2129697 commit 18881de
Show file tree
Hide file tree
Showing 10 changed files with 398 additions and 310 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ If you are interested in our commercial services please contact [email protected]
All these sources of funding, whether it is sponsorship or our commercial services, help us to maintain Cuemacro's libraries,
so we can improve our open source libraries for the community.

# Problems with Numba and doing options pricing in finmarketpy/financepy

Underneath finmarketpy uses financepy to do option pricing. It uses Numba to speed up the computation.

You may sometimes experience Numba errors like such as `Failed in nopython mode pipeline (step: nopython frontend)`

One possible way to fix this is to delete the `__pycache__` folders underneath wherever financepy is installed:

Eg. if you are using the `py38class` environment, if you've installed Anaconda in `C:\Anaconda3`, you might find the financepy
folder at the below location

`C:\Anaconda3\envs\py38\Lib\site-packages\financepy`

# finmarketpy examples

In finmarketpy/examples you will find several examples, including some simple trading models
Expand All @@ -173,6 +186,9 @@ In finmarketpy/examples you will find several examples, including some simple tr

# finmarketpy log

* 05 Apr 2022
* Set FinancePy version required to 0.220 and refactored FXVolSurface for
this
* 07 Oct 2021
* Set FinancePy version required to 0.193
* 23 Sep 2021
Expand Down
7 changes: 5 additions & 2 deletions finmarketpy/curve/rates/fxforwardspricer.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,13 @@ def get_forwards_divisor(self, currency):
# Typically most divisors of forward points are 10000.0
divisor = 10000.0

if currency in market_constants.fx_forwards_points_divisor_100:
if currency in market_constants.fx_forwards_points_divisor_1:
divisor = 1.0

elif currency in market_constants.fx_forwards_points_divisor_100:
divisor = 100.0

if currency in market_constants.fx_forwards_points_divisor_1000:
elif currency in market_constants.fx_forwards_points_divisor_1000:
divisor = 1000.0

return divisor
Expand Down
4 changes: 2 additions & 2 deletions finmarketpy/curve/volatility/abstractvolsurface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})

from financepy.finutils.FinDate import FinDate
from financepy.utils.date import Date

class AbstractVolSurface(ABC):
"""Holds data for an asset class vol surface
Expand Down Expand Up @@ -95,4 +95,4 @@ def _get_tenor_expiry(self, tenor):
return

def _findate(self, date):
return FinDate(date.day, date.month, date.year)
return Date(date.day, date.month, date.year)
253 changes: 160 additions & 93 deletions finmarketpy/curve/volatility/fxvolsurface.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions finmarketpy/util/marketconstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class MarketConstants(object):
output_calculation_fields = False

### FX Forwards ########################################################################################################
fx_forwards_points_divisor_1 = ['IDR']
fx_forwards_points_divisor_100 = ['JPY']
fx_forwards_points_divisor_1000 = []

Expand Down
102 changes: 51 additions & 51 deletions finmarketpy_examples/finmarketpy_notebooks/backtest_example.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2021-06-01T11:43:54.457449Z",
"start_time": "2021-06-01T11:43:44.153477Z"
"end_time": "2022-01-26T15:56:07.408175Z",
"start_time": "2022-01-26T15:55:59.685770Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -51,11 +51,11 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2021-06-01T11:43:55.283797Z",
"start_time": "2021-06-01T11:43:54.459444Z"
"end_time": "2022-01-26T15:56:10.503206Z",
"start_time": "2022-01-26T15:56:07.410175Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -113,8 +113,8 @@
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:51.312494Z",
"start_time": "2021-05-04T16:36:51.299494Z"
"end_time": "2022-01-26T15:56:13.371422Z",
"start_time": "2022-01-26T15:56:13.231436Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -151,8 +151,8 @@
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:52.213414Z",
"start_time": "2021-05-04T16:36:51.314494Z"
"end_time": "2022-01-26T15:56:15.548520Z",
"start_time": "2022-01-26T15:56:14.242467Z"
}
},
"outputs": [],
Expand All @@ -172,8 +172,8 @@
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:52.228419Z",
"start_time": "2021-05-04T16:36:52.215417Z"
"end_time": "2022-01-26T15:56:16.404113Z",
"start_time": "2022-01-26T15:56:16.384105Z"
}
},
"outputs": [],
Expand All @@ -198,8 +198,8 @@
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:52.635473Z",
"start_time": "2021-05-04T16:36:52.230418Z"
"end_time": "2022-01-26T15:56:17.800925Z",
"start_time": "2022-01-26T15:56:17.350447Z"
}
},
"outputs": [
Expand Down Expand Up @@ -229,11 +229,11 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:54.375641Z",
"start_time": "2021-05-04T16:36:52.637473Z"
"end_time": "2022-01-26T16:14:20.356515Z",
"start_time": "2022-01-26T16:14:18.664996Z"
}
},
"outputs": [
Expand All @@ -243,17 +243,17 @@
"text": [
" EURUSD.close\n",
"Date \n",
"2020-05-05 1.0840\n",
"2020-05-06 1.0795\n",
"2020-05-07 1.0834\n",
"2020-05-08 1.0839\n",
"2020-05-11 1.0807\n",
"2021-01-27 1.2111\n",
"2021-01-28 1.2122\n",
"2021-01-29 1.2136\n",
"2021-02-01 1.2060\n",
"2021-02-02 1.2044\n",
"... ...\n",
"2021-04-28 1.2126\n",
"2021-04-29 1.2121\n",
"2021-04-30 1.2020\n",
"2021-05-03 1.2064\n",
"2021-05-04 1.2013\n",
"2022-01-20 1.1312\n",
"2022-01-21 1.1344\n",
"2022-01-24 1.1326\n",
"2022-01-25 1.1301\n",
"2022-01-26 1.1285\n",
"\n",
"[261 rows x 1 columns]\n"
]
Expand All @@ -276,8 +276,8 @@
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2021-05-04T16:36:56.657212Z",
"start_time": "2021-05-04T16:36:54.378641Z"
"end_time": "2022-01-26T15:56:24.329239Z",
"start_time": "2022-01-26T15:56:22.005440Z"
}
},
"outputs": [
Expand All @@ -287,17 +287,17 @@
"text": [
" EURUSD.close\n",
"Date \n",
"2021-04-27 16:37:00+00:00 1.2071\n",
"2021-04-27 16:38:00+00:00 1.2072\n",
"2021-04-27 16:39:00+00:00 1.2072\n",
"2021-04-27 16:40:00+00:00 1.2072\n",
"2021-04-27 16:41:00+00:00 1.2073\n",
"2022-01-19 15:57:00+00:00 1.1344\n",
"2022-01-19 15:58:00+00:00 1.1345\n",
"2022-01-19 15:59:00+00:00 1.1345\n",
"2022-01-19 16:00:00+00:00 1.1347\n",
"2022-01-19 16:01:00+00:00 1.1345\n",
"... ...\n",
"2021-05-04 16:32:00+00:00 1.2015\n",
"2021-05-04 16:33:00+00:00 1.2014\n",
"2021-05-04 16:34:00+00:00 1.2015\n",
"2021-05-04 16:35:00+00:00 1.2013\n",
"2021-05-04 16:36:00+00:00 1.2012\n",
"2022-01-26 15:52:00+00:00 1.1282\n",
"2022-01-26 15:53:00+00:00 1.1281\n",
"2022-01-26 15:54:00+00:00 1.1281\n",
"2022-01-26 15:55:00+00:00 1.1281\n",
"2022-01-26 15:56:00+00:00 1.1282\n",
"\n",
"[7200 rows x 1 columns]\n"
]
Expand All @@ -317,11 +317,11 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2021-06-01T11:44:11.043778Z",
"start_time": "2021-06-01T11:44:09.307217Z"
"end_time": "2022-01-26T15:56:28.474360Z",
"start_time": "2022-01-26T15:56:26.101164Z"
}
},
"outputs": [
Expand All @@ -331,10 +331,11 @@
"text": [
" VIX.close\n",
"Date \n",
"2021-05-26 17.360001\n",
"2021-05-27 16.740000\n",
"2021-05-28 16.760000\n",
"2021-06-01 17.150000\n"
"2022-01-20 25.590000\n",
"2022-01-21 28.850000\n",
"2022-01-24 29.900000\n",
"2022-01-25 31.160000\n",
"2022-01-26 29.700001\n"
]
}
],
Expand Down Expand Up @@ -630,4 +631,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Loading

0 comments on commit 18881de

Please sign in to comment.