# yfinance-timeframe-converter
### Converts an YFinance DataFrame to other timeframe
Instead of calling the yFinance's API again, why not just to convert your current DataFrame, making the whole process faster? Or to convert it to a non-downloadable timeframe?
This is what **yfinance-timeframe-converter** does.
Convert your DataFrame to up to **33 timeframes** of your choise, **22 more than the yFinance** timeframes available.
Uses C++ functions to make all process faster, converting large amount of data in less than 0.1 seconds.
## How to use
### How to convert a DataFrame
The `timeframe_converter` function allows you to convert your DataFrame.
To convert a DataFrame, pass the original DataFrame, the DataFrame's timeframe, and the output desired timeframe.
```python
import yfinance_timeframe_converter as converter
from pandas_datareader import data as pdr
import yfinance as yf
ticket = "AAPL"
input_timeframe = "1d"
output_timeframe = "1wk"
yf.pdr_override()
df = pdr.get_data_yahoo(tickers=ticket, interval=input_timeframe)
# Pass the dataframe, the timeframe of the Dataframe, and the timeframe desired. Returns the converted DataFrame
converted_timeframe = converter.timeframe_converter(df, input_timeframe, output_timeframe)
```
### Arguments
- `data` - pd.DataFrame -> The dataframe you desire to convert
- `timeframe_input` - string -> The timeframe of the DataFrame
- `timeframe_output` - string -> The timeframe you desire to convert to
- `checking` - bool -> Checks if all variables are valid, if False, the code will run about 10% faster, you can have serious errors
#
### How many timeframes are available to use?
```python
import yfinance_timeframe_converter as converter
# Gets all timeframes available to donwload from yFinance - 13 timeframes
print(converter.yfinance_available_timeframes) # ["1m", "2m", "5m", "15m", "30m", "60m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo"]
# Gets all timeframes available to pass as input to the function - 35 timeframes
print(converter.converter_available_inputs) # ["1m", "2m", "3m", "4m", "5m", "6m", "10m", "12m", "15m", "20m", "30m", "60m", "1h", "90m", "2h", "3h", "4h", "6h", ... "4mo", "6mo", "1yr", "2yr"]
# Gets all Outputs available of the function - 33 timeframes
print(converter.converter_available_outputs) # ["1m", "2m", "3m", "4m", "5m", "6m", "10m", "12m", "15m", "20m", "30m", "60m", "1h", "90m", "2h", "3h", "4h", "6h", ... "4mo", "6mo", "1yr", "2yr"]
# Gets all convertions available
print(converter.available_convertions) # {"1m" = ["2m", "3m", "4m", "5m", "6m", "10m", "12m", "15m", "20m", "30m", "60m", "1h"...]}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/LucasRocha-Png/yfinance-timeframe-converter",
"name": "yfinance-timeframe-converter",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,yfinance,changer,yahoo,finance",
"author": "Lucas Rocha",
"author_email": "lucasrocha.png@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/46/18/18b4e41cb91e1da85d99059a213dd4ecbf6537b21335cc28cd1d172f9f03/yfinance_timeframe_converter-1.0.2.tar.gz",
"platform": null,
"description": "# yfinance-timeframe-converter\n### Converts an YFinance DataFrame to other timeframe\n\nInstead of calling the yFinance's API again, why not just to convert your current DataFrame, making the whole process faster? Or to convert it to a non-downloadable timeframe? \n\nThis is what **yfinance-timeframe-converter** does.\n\nConvert your DataFrame to up to **33 timeframes** of your choise, **22 more than the yFinance** timeframes available.\n\nUses C++ functions to make all process faster, converting large amount of data in less than 0.1 seconds.\n\n## How to use\n### How to convert a DataFrame\nThe `timeframe_converter` function allows you to convert your DataFrame.\n\nTo convert a DataFrame, pass the original DataFrame, the DataFrame's timeframe, and the output desired timeframe.\n```python\nimport yfinance_timeframe_converter as converter\nfrom pandas_datareader import data as pdr\nimport yfinance as yf\n\nticket = \"AAPL\"\ninput_timeframe = \"1d\"\noutput_timeframe = \"1wk\"\n\nyf.pdr_override() \ndf = pdr.get_data_yahoo(tickers=ticket, interval=input_timeframe)\n\n# Pass the dataframe, the timeframe of the Dataframe, and the timeframe desired. Returns the converted DataFrame\nconverted_timeframe = converter.timeframe_converter(df, input_timeframe, output_timeframe)\n```\n\n### Arguments\n- `data` - pd.DataFrame -> The dataframe you desire to convert\n- `timeframe_input` - string -> The timeframe of the DataFrame\n- `timeframe_output` - string -> The timeframe you desire to convert to\n- `checking` - bool -> Checks if all variables are valid, if False, the code will run about 10% faster, you can have serious errors\n\n#\n### How many timeframes are available to use?\n```python\nimport yfinance_timeframe_converter as converter\n\n# Gets all timeframes available to donwload from yFinance - 13 timeframes\nprint(converter.yfinance_available_timeframes) # [\"1m\", \"2m\", \"5m\", \"15m\", \"30m\", \"60m\", \"90m\", \"1h\", \"1d\", \"5d\", \"1wk\", \"1mo\", \"3mo\"] \n\n# Gets all timeframes available to pass as input to the function - 35 timeframes\nprint(converter.converter_available_inputs) # [\"1m\", \"2m\", \"3m\", \"4m\", \"5m\", \"6m\", \"10m\", \"12m\", \"15m\", \"20m\", \"30m\", \"60m\", \"1h\", \"90m\", \"2h\", \"3h\", \"4h\", \"6h\", ... \"4mo\", \"6mo\", \"1yr\", \"2yr\"] \n\n# Gets all Outputs available of the function - 33 timeframes\nprint(converter.converter_available_outputs) # [\"1m\", \"2m\", \"3m\", \"4m\", \"5m\", \"6m\", \"10m\", \"12m\", \"15m\", \"20m\", \"30m\", \"60m\", \"1h\", \"90m\", \"2h\", \"3h\", \"4h\", \"6h\", ... \"4mo\", \"6mo\", \"1yr\", \"2yr\"] \n\n# Gets all convertions available\nprint(converter.available_convertions) # {\"1m\" = [\"2m\", \"3m\", \"4m\", \"5m\", \"6m\", \"10m\", \"12m\", \"15m\", \"20m\", \"30m\", \"60m\", \"1h\"...]}\n```\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Converts YFinance's tables in other timeframe in an faster way",
"version": "1.0.2",
"split_keywords": [
"python",
"yfinance",
"changer",
"yahoo",
"finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e707c6bbff2f59544df53d51b569603eb72de2e6be590baf077fd359c88908c9",
"md5": "9d83a9d251323d60b1c428d95a1ffb64",
"sha256": "206ba9d88ee95ada623630b60e1ec9205fe92193431877bf75cdad9deb671b62"
},
"downloads": -1,
"filename": "yfinance_timeframe_converter-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d83a9d251323d60b1c428d95a1ffb64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8441,
"upload_time": "2023-01-13T12:31:37",
"upload_time_iso_8601": "2023-01-13T12:31:37.065126Z",
"url": "https://files.pythonhosted.org/packages/e7/07/c6bbff2f59544df53d51b569603eb72de2e6be590baf077fd359c88908c9/yfinance_timeframe_converter-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "461818b4e41cb91e1da85d99059a213dd4ecbf6537b21335cc28cd1d172f9f03",
"md5": "c60a3dc0e302aeab1c35f013369dc16e",
"sha256": "41dbaa855e8b7bcfd5c386007cff24d586f9242fc3da52edacb036cc5cf02873"
},
"downloads": -1,
"filename": "yfinance_timeframe_converter-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c60a3dc0e302aeab1c35f013369dc16e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7366,
"upload_time": "2023-01-13T12:31:39",
"upload_time_iso_8601": "2023-01-13T12:31:39.471095Z",
"url": "https://files.pythonhosted.org/packages/46/18/18b4e41cb91e1da85d99059a213dd4ecbf6537b21335cc28cd1d172f9f03/yfinance_timeframe_converter-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-13 12:31:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "LucasRocha-Png",
"github_project": "yfinance-timeframe-converter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "yfinance-timeframe-converter"
}