# pinetwig 0.2.1
[PineTwig](https://github.com/AyberkAtalay0/pinetwig/) is a pinescript-like financial data analysis and trading package.
## Requirements
- Python 3.7 or above on Windows, Linux or macOS
## Installation
```
pip install pinetwig
```
## Examples
Create ```main.py``` file with one of the following examples:
#### Scraping data from Binance.
```
import pinetwig as pt
df = pt.getDataFromBinance(ticker="BTCUSDT", interval="1h", start="2 day ago UTC", end="now")
print(df)
```
#### Scraping data from TradingView.
```
import pinetwig as pt
df = pt.getDataFromTradingView(symbol="NASDAQ:AAPL", interval="5m", length=5000)
print(df)
```
#### List available indicators.
```
import pinetwig as pt
for i in pt.indicators.all:
print(i)
```
#### Visualizing a financial dataframe. (Candlestick Chart)
```
import pinetwig as pt
df = pt.getDataFromBinance(ticker="BTCUSDT", interval="1h", start="2 day ago UTC", end="now")
df["SMA12"] = pt.sma(df["Close"], 12)
x, y = list(range(len(df))), df["Close"].tolist()
df["Ray1"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*1.02))
df["Ray2"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*0.98))
chart = pt.FancyChart(df, theme="light")
chart.show()
```
#### Generating a linear regression line.
```
import pinetwig as pt
df = pt.getDataFromBinance(ticker="BTCUSDT", interval="1h", start="2 days ago UTC", end="now")
x, y1 = list(range(len(df))), df["Close"].tolist()
y2 = pt.linreg(x, y1)
pt.visualize(lines={"Values": {"x": x, "y": y1}, "Linear Reg.": {"x": x, "y": y2}})
```
#### Generating a ray and visualizing.
```
import pinetwig as pt
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1]
ray = pt.ray(x, (0, 0), (2, 1))
pt.visualize(lines={"Values": {"x": x, "y": y}, "Ray": {"x": x, "y": ray}})
```
## Learn more
- [PineTwig GitHub](https://github.com/AyberkAtalay0/pinetwig/)
- [PineTwig PyPI](https://pypi.org/project/pinetwig/)
Raw data
{
"_id": null,
"home_page": "https://github.com/AyberkAtalay0/pinetwig",
"name": "pinetwig",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "python, pinetwig, financial, data, analysis, tradingview, binance, pinescript, trading, cryptocurrency, chart, candlestick, plotly, matplotlib, visualizing",
"author": "Ayberk ATALAY",
"author_email": "ayberkatalaypersonal@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/83/6f/8a83ce53386930f2dc581dce170adc23f18375b665f6d104f47e5c2f0e3b/pinetwig-0.2.1.tar.gz",
"platform": null,
"description": "# pinetwig 0.2.1\r\n[PineTwig](https://github.com/AyberkAtalay0/pinetwig/) is a pinescript-like financial data analysis and trading package.\r\n\r\n## Requirements\r\n- Python 3.7 or above on Windows, Linux or macOS\r\n\r\n## Installation\r\n```\r\npip install pinetwig\r\n```\r\n\r\n## Examples\r\nCreate ```main.py``` file with one of the following examples:\r\n\r\n#### Scraping data from Binance.\r\n```\r\nimport pinetwig as pt\r\n\r\ndf = pt.getDataFromBinance(ticker=\"BTCUSDT\", interval=\"1h\", start=\"2 day ago UTC\", end=\"now\")\r\nprint(df)\r\n```\r\n\r\n#### Scraping data from TradingView.\r\n```\r\nimport pinetwig as pt\r\n\r\ndf = pt.getDataFromTradingView(symbol=\"NASDAQ:AAPL\", interval=\"5m\", length=5000)\r\nprint(df)\r\n```\r\n\r\n#### List available indicators.\r\n```\r\nimport pinetwig as pt\r\n\r\nfor i in pt.indicators.all:\r\n print(i)\r\n```\r\n\r\n#### Visualizing a financial dataframe. (Candlestick Chart)\r\n```\r\nimport pinetwig as pt\r\n\r\ndf = pt.getDataFromBinance(ticker=\"BTCUSDT\", interval=\"1h\", start=\"2 day ago UTC\", end=\"now\")\r\n\r\ndf[\"SMA12\"] = pt.sma(df[\"Close\"], 12)\r\n\r\nx, y = list(range(len(df))), df[\"Close\"].tolist()\r\ndf[\"Ray1\"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*1.02))\r\ndf[\"Ray2\"] = pt.ray(x, (x[0], y[0]), (x[-1], y[-1]*0.98))\r\n\r\nchart = pt.FancyChart(df, theme=\"light\")\r\nchart.show()\r\n```\r\n\r\n#### Generating a linear regression line.\r\n```\r\nimport pinetwig as pt\r\n\r\ndf = pt.getDataFromBinance(ticker=\"BTCUSDT\", interval=\"1h\", start=\"2 days ago UTC\", end=\"now\")\r\nx, y1 = list(range(len(df))), df[\"Close\"].tolist()\r\ny2 = pt.linreg(x, y1)\r\n\r\npt.visualize(lines={\"Values\": {\"x\": x, \"y\": y1}, \"Linear Reg.\": {\"x\": x, \"y\": y2}})\r\n```\r\n\r\n#### Generating a ray and visualizing.\r\n```\r\nimport pinetwig as pt\r\n\r\nx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\r\ny = [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1]\r\nray = pt.ray(x, (0, 0), (2, 1))\r\n\r\npt.visualize(lines={\"Values\": {\"x\": x, \"y\": y}, \"Ray\": {\"x\": x, \"y\": ray}})\r\n```\r\n\r\n## Learn more\r\n- [PineTwig GitHub](https://github.com/AyberkAtalay0/pinetwig/)\r\n- [PineTwig PyPI](https://pypi.org/project/pinetwig/)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A pinescript-like financial data analysis and trading package",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/AyberkAtalay0/pinetwig"
},
"split_keywords": [
"python",
" pinetwig",
" financial",
" data",
" analysis",
" tradingview",
" binance",
" pinescript",
" trading",
" cryptocurrency",
" chart",
" candlestick",
" plotly",
" matplotlib",
" visualizing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "836f8a83ce53386930f2dc581dce170adc23f18375b665f6d104f47e5c2f0e3b",
"md5": "5aae215523a2d58c4d0c90c2cf570e2f",
"sha256": "e16a8d93d1940e34d7e3dc123ae825a28ac41ad2b9eabc1055d7630e0df5a3c9"
},
"downloads": -1,
"filename": "pinetwig-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "5aae215523a2d58c4d0c90c2cf570e2f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 10006,
"upload_time": "2024-07-11T05:32:34",
"upload_time_iso_8601": "2024-07-11T05:32:34.492395Z",
"url": "https://files.pythonhosted.org/packages/83/6f/8a83ce53386930f2dc581dce170adc23f18375b665f6d104f47e5c2f0e3b/pinetwig-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-11 05:32:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AyberkAtalay0",
"github_project": "pinetwig",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pinetwig"
}