Skip to content

Commit

Permalink
deploy: 319cad8
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonfreitas committed Oct 29, 2023
1 parent 2734493 commit ab1b1be
Show file tree
Hide file tree
Showing 6 changed files with 865 additions and 6 deletions.
298 changes: 296 additions & 2 deletions _sources/calendars.ipynb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"The `Calendar` can be built in three ways:\n",
"\n",
"- using the constructor `Calendar` passing the arguments\n",
"- with the `Calendar.load(name=\"<calendar name>\")` passing the name of a calendar delivered with the package (`B3` or `ANBIMA`)\n",
"- with the `Calendar.load(name=\"<calendar name>\")` passing the name of a calendar delivered with the package (`B3`, `ANBIMA`, `Actual`) or calendars from `pandas_market_calendar` package\n",
"- with the `Calendar.load(filename=\"<calendar filename>\")` passing a file that describes a valid calendar\n",
"\n",
"## Calendars from file\n",
"\n",
"The file describing the calendar is a text file with the weekdays and holidays that represents the nonworking days."
]
},
Expand Down Expand Up @@ -71,6 +73,17 @@
"Calendar.load(filename='Test.cal')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Predefined Calendars\n",
"\n",
"`bizdays` comes with some predefined calendars: `ANBIMA`, `B3`, `Actual`, that can be directly loaded by its names.\n",
"\n",
"`ANBIMA` is the standard calendar used in the brazilian fixed income markets."
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -100,6 +113,287 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`Actual` is a calendar with no holiday and nonworking days."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Calendar: Actual\n",
"Start: 1970-01-01\n",
"End: 2071-01-01\n",
"Weekdays: \n",
"Holidays: 0\n",
"Financial: True"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Calendar.load(\"Actual\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Calendars from `pandas_market_calendars`\n",
"\n",
"The package [`pandas_market_calendars`](https://github.com/rsheftel/pandas_market_calendars) comes with many predefined calendars."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['ASX',\n",
" 'BMF',\n",
" 'B3',\n",
" 'BSE',\n",
" 'NSE',\n",
" 'CFE',\n",
" 'CBOE_Futures',\n",
" 'CBOE_Equity_Options',\n",
" 'CBOE_Index_Options',\n",
" 'CME_Equity',\n",
" 'CBOT_Equity',\n",
" 'CME_Agriculture',\n",
" 'CBOT_Agriculture',\n",
" 'COMEX_Agriculture',\n",
" 'NYMEX_Agriculture',\n",
" 'CME_Rate',\n",
" 'CBOT_Rate',\n",
" 'CME_InterestRate',\n",
" 'CBOT_InterestRate',\n",
" 'CME_Bond',\n",
" 'CBOT_Bond',\n",
" 'CMEGlobex_Livestock',\n",
" 'CMEGlobex_Live_Cattle',\n",
" 'CMEGlobex_Feeder_Cattle',\n",
" 'CMEGlobex_Lean_Hog',\n",
" 'CMEGlobex_Port_Cutout',\n",
" 'CME Globex Cryptocurrencies',\n",
" 'CME Globex Crypto',\n",
" 'CMEGlobex_EnergyAndMetals',\n",
" 'CMEGlobex_Energy',\n",
" 'CMEGlobex_CrudeAndRefined',\n",
" 'CMEGlobex_NYHarbor',\n",
" 'CMEGlobex_HO',\n",
" 'HO',\n",
" 'CMEGlobex_Crude',\n",
" 'CMEGlobex_CL',\n",
" 'CL',\n",
" 'CMEGlobex_Gas',\n",
" 'CMEGlobex_RB',\n",
" 'RB',\n",
" 'CMEGlobex_MicroCrude',\n",
" 'CMEGlobex_MCL',\n",
" 'MCL',\n",
" 'CMEGlobex_NatGas',\n",
" 'CMEGlobex_NG',\n",
" 'NG',\n",
" 'CMEGlobex_Dutch_NatGas',\n",
" 'CMEGlobex_TTF',\n",
" 'TTF',\n",
" 'CMEGlobex_LastDay_NatGas',\n",
" 'CMEGlobex_NN',\n",
" 'NN',\n",
" 'CMEGlobex_CarbonOffset',\n",
" 'CMEGlobex_CGO',\n",
" 'CGO',\n",
" 'C-GEO',\n",
" 'CMEGlobex_NGO',\n",
" 'NGO',\n",
" 'CMEGlobex_GEO',\n",
" 'GEO',\n",
" 'CMEGlobex_Metals',\n",
" 'CMEGlobex_PreciousMetals',\n",
" 'CMEGlobex_Gold',\n",
" 'CMEGlobex_GC',\n",
" 'GC',\n",
" 'CMEGlobex_SilverCMEGlobex_SI',\n",
" 'SI',\n",
" 'CMEGlobex_Platinum',\n",
" 'CMEGlobex_PL',\n",
" 'PL',\n",
" 'CMEGlobex_BaseMetals',\n",
" 'CMEGlobex_Copper',\n",
" 'CMEGlobex_HG',\n",
" 'HG',\n",
" 'CMEGlobex_Aluminum',\n",
" 'CMEGlobex_ALI',\n",
" 'ALI',\n",
" 'CMEGlobex_QC',\n",
" 'QC',\n",
" 'CMEGlobex_FerrousMetals',\n",
" 'CMEGlobex_HRC',\n",
" 'HRC',\n",
" 'CMEGlobex_BUS',\n",
" 'BUS',\n",
" 'CMEGlobex_TIO',\n",
" 'TIO',\n",
" 'CME Globex Equity',\n",
" 'CMEGlobex_FX',\n",
" 'CME_FX',\n",
" 'CME_Currency',\n",
" 'CME Globex Fixed Income',\n",
" 'CME Globex Interest Rate Products',\n",
" 'EUREX',\n",
" 'HKEX',\n",
" 'ICE',\n",
" 'ICEUS',\n",
" 'NYFE',\n",
" 'NYSE',\n",
" 'stock',\n",
" 'NASDAQ',\n",
" 'BATS',\n",
" 'DJIA',\n",
" 'DOW',\n",
" 'IEX',\n",
" 'Investors_Exchange',\n",
" 'JPX',\n",
" 'LSE',\n",
" 'OSE',\n",
" 'SIFMAUS',\n",
" 'SIFMA_US',\n",
" 'Capital_Markets_US',\n",
" 'Financial_Markets_US',\n",
" 'Bond_Markets_US',\n",
" 'SIFMAUK',\n",
" 'SIFMA_UK',\n",
" 'Capital_Markets_UK',\n",
" 'Financial_Markets_UK',\n",
" 'Bond_Markets_UK',\n",
" 'SIFMAJP',\n",
" 'SIFMA_JP',\n",
" 'Capital_Markets_JP',\n",
" 'Financial_Markets_JP',\n",
" 'Bond_Markets_JP',\n",
" 'SIX',\n",
" 'SSE',\n",
" 'TASE',\n",
" 'TSX',\n",
" 'TSXV',\n",
" 'AIXK',\n",
" 'ASEX',\n",
" 'BVMF',\n",
" 'CMES',\n",
" 'IEPA',\n",
" 'XAMS',\n",
" 'XASX',\n",
" 'XBKK',\n",
" 'XBOG',\n",
" 'XBOM',\n",
" 'XBRU',\n",
" 'XBSE',\n",
" 'XBUD',\n",
" 'XBUE',\n",
" 'XCBF',\n",
" 'XCSE',\n",
" 'XDUB',\n",
" 'XFRA',\n",
" 'XETR',\n",
" 'XHEL',\n",
" 'XHKG',\n",
" 'XICE',\n",
" 'XIDX',\n",
" 'XIST',\n",
" 'XJSE',\n",
" 'XKAR',\n",
" 'XKLS',\n",
" 'XKRX',\n",
" 'XLIM',\n",
" 'XLIS',\n",
" 'XLON',\n",
" 'XMAD',\n",
" 'XMEX',\n",
" 'XMIL',\n",
" 'XMOS',\n",
" 'XNYS',\n",
" 'XNZE',\n",
" 'XOSL',\n",
" 'XPAR',\n",
" 'XPHS',\n",
" 'XPRA',\n",
" 'XSAU',\n",
" 'XSES',\n",
" 'XSGO',\n",
" 'XSHG',\n",
" 'XSTO',\n",
" 'XSWX',\n",
" 'XTAE',\n",
" 'XTAI',\n",
" 'XTKS',\n",
" 'XTSE',\n",
" 'XWAR',\n",
" 'XWBO',\n",
" 'us_futures',\n",
" '24/7',\n",
" '24/5']"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas_market_calendars as mcal\n",
"\n",
"mcal.get_calendar_names()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"These calendars can be loaded in bizdays with the prefix `PMC/` in its name.\n",
"For example, use `PMC/NYSE` to load the NYSE calendar."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Calendar: PMC/NYSE\n",
"Start: 1885-01-01\n",
"End: 2200-12-25\n",
"Weekdays: Saturday, Sunday\n",
"Holidays: 3552\n",
"Financial: True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Calendar.load(\"PMC/NYSE\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create your own Calendars\n",
"\n",
"`Calendar` can be called with no arguments and it returns a calendar without nonworking days."
]
},
Expand Down Expand Up @@ -241,7 +535,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
"version": "3.10.11"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit ab1b1be

Please sign in to comment.