# <img src="https://api.sphoin.app/logo" alt="drawing" width="100"/>
[](https://pypi.org/project/sphoin/) [](https://img.shields.io/pypi/pyversions/sphoin.svg)
Connect to [sphoin.app](https://www.sphoin.app) Pro Slots.
<img src="https://firebasestorage.googleapis.com/v0/b/sphoin-545ba.appspot.com/o/tui.png?alt=media&token=99083efe-74eb-4418-b7f9-abdca46d573f" alt="drawing" width="100%" />
# Installation
## Stable release
To install sphoin, run this command in your terminal:
```
pip install sphoin
```
This is the preferred method to install sphoin, as it will always install the most recent stable release.
## From sources
The sources for sphoin can be downloaded from the `Github repo`.
* clone the public repository
```
git clone https://github.com/Parsecom/sphoin
```
* install from source
```
python setup.py install
```
## Docker
```
docker pull pom11/sphoin
```
## `.yaml` config file
```yaml
---
uid: 111YOURUID111
api-key: 111YOURAPIKEY111
api-secret: 111YOURSECRET111
layout:
- line
- time
- signals
- studies
- footer
```
In `layout` specifies what `Plot`s should be displayed
* `line` - Price graph
* `time` - Time bar
* `signals` - Signals sum graph
* `studies` - Studies bars
* `footer` - Footer with Slot details
# Usage
## TUI key bindings
* h - Help sidebar
* r - Refresh Slot data
* t - Toggle theme
* s - Signals theme
* b - Toggle brightness
* q - Quit
## CLI
```
sphoin --help
```
View example
```
sphoin --example
```
Load config file
```
sphoin --config config.yaml
```
Print Plot test
```
sphoin --plot
sphoin.plot
```
## Docker
Pull image from docker hub
```shell
docker pull pom11/sphoin
```
To run sphoin TUI with `config` file in docker you need to mount local directory to `/usr/src/app`
```shell
docker run -v ${PWD}/config.yaml:/usr/src/app/config.yaml -it pom11/sphoin -c config.yaml
```
## Python
Import package
```python
from sphoin.app import Slot
```
### Slot from keys
```python
my_slot = Slot.from_keys(uid="111YOURUID111",
api_key="111YOURAPIKEY111",
api_secret="111YOURSECRET111")
```
### Slot from config file
```python
my_slot = Slot.from_config(file="/absolute/path/of/config.yaml")
```
### Slot from dict
Obtain dict from `https://api.sphoin.app/api/v1/data/json` endpoint
```python
import requests
url = "https://api.sphoin.app/api/v1/data/json"
payload = "{\n \"uid\": \"111YOURUID111\",\n \"api-key\": \"111YOURAPIKEY111\",\n \"api-secret\": \"111YOURSECRET111\"\n}"
headers = {
'X-sphoin.app': 'LIadeCyi15FAwoRBkiu9fJsYPvWecSxb'
}
response = requests.request("POST", url, headers=headers, data=payload)
json = response.json()
```
Init Slot from obtained result
```python
my_slot = Slot.from_dict(data=json)
```
### Inspect Slot
```python
from rich import print
from rich import inspect
print(my_slot.json)
# insepct slot attributes
print(my_slot.__doc__)
print(inspect(my_slot,all=True))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Parsecom/sphoin",
"name": "sphoin",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "sphoin",
"author": "P.O.M.",
"author_email": "office@parsecom.ro",
"download_url": "https://files.pythonhosted.org/packages/05/2a/20471f48e73b42f7341b69d62c4a031fba567ab15e1ed3bf3a954ef93a02/sphoin-2.0.12.tar.gz",
"platform": null,
"description": "\n\n# <img src=\"https://api.sphoin.app/logo\" alt=\"drawing\" width=\"100\"/>\n\n[](https://pypi.org/project/sphoin/) [](https://img.shields.io/pypi/pyversions/sphoin.svg)\n\nConnect to [sphoin.app](https://www.sphoin.app) Pro Slots.\n\n<img src=\"https://firebasestorage.googleapis.com/v0/b/sphoin-545ba.appspot.com/o/tui.png?alt=media&token=99083efe-74eb-4418-b7f9-abdca46d573f\" alt=\"drawing\" width=\"100%\" />\n\n# Installation\n\n## Stable release\nTo install sphoin, run this command in your terminal:\n\n```\npip install sphoin\n```\n\nThis is the preferred method to install sphoin, as it will always install the most recent stable release.\n\n## From sources\n\nThe sources for sphoin can be downloaded from the `Github repo`.\n* clone the public repository\n```\ngit clone https://github.com/Parsecom/sphoin\n```\n* install from source\n```\npython setup.py install\n```\n\n## Docker\n```\ndocker pull pom11/sphoin\n```\n\n## `.yaml` config file\n```yaml\n---\nuid: 111YOURUID111\napi-key: 111YOURAPIKEY111\napi-secret: 111YOURSECRET111\nlayout:\n - line\n - time\n - signals\n - studies\n - footer\n \n```\n\nIn `layout` specifies what `Plot`s should be displayed\n\n* `line` - Price graph\n* `time` - Time bar\n* `signals` - Signals sum graph\n* `studies` - Studies bars\n* `footer` - Footer with Slot details\n\n# Usage\n\n## TUI key bindings\n\n* h - Help sidebar\n* r - Refresh Slot data\n* t - Toggle theme\n* s - Signals theme\n* b - Toggle brightness\n* q - Quit\n\n## CLI\n```\nsphoin --help\n```\nView example\n```\nsphoin --example\n```\nLoad config file\n```\nsphoin --config config.yaml\n```\nPrint Plot test\n```\nsphoin --plot\nsphoin.plot\n```\n\n## Docker\nPull image from docker hub\n```shell\ndocker pull pom11/sphoin\n```\nTo run sphoin TUI with `config` file in docker you need to mount local directory to `/usr/src/app`\n```shell\ndocker run -v ${PWD}/config.yaml:/usr/src/app/config.yaml -it pom11/sphoin -c config.yaml\n``` \n\n\n## Python\n\nImport package\n```python\nfrom sphoin.app import Slot\n```\n### Slot from keys\n```python\nmy_slot = Slot.from_keys(uid=\"111YOURUID111\",\n api_key=\"111YOURAPIKEY111\",\n api_secret=\"111YOURSECRET111\")\n```\n### Slot from config file\n```python\nmy_slot = Slot.from_config(file=\"/absolute/path/of/config.yaml\")\n```\n### Slot from dict\nObtain dict from `https://api.sphoin.app/api/v1/data/json` endpoint\n```python\nimport requests\n\nurl = \"https://api.sphoin.app/api/v1/data/json\"\n\npayload = \"{\\n \\\"uid\\\": \\\"111YOURUID111\\\",\\n \\\"api-key\\\": \\\"111YOURAPIKEY111\\\",\\n \\\"api-secret\\\": \\\"111YOURSECRET111\\\"\\n}\"\nheaders = {\n 'X-sphoin.app': 'LIadeCyi15FAwoRBkiu9fJsYPvWecSxb'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\njson = response.json()\n```\nInit Slot from obtained result\n```python\nmy_slot = Slot.from_dict(data=json)\n```\n### Inspect Slot\n```python\nfrom rich import print\nfrom rich import inspect\n\nprint(my_slot.json)\n# insepct slot attributes\nprint(my_slot.__doc__)\nprint(inspect(my_slot,all=True))\n```\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Connect to sphoin.app Pro Slots",
"version": "2.0.12",
"split_keywords": [
"sphoin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b780fe5085385ca69056191bdc7c4b7dee6f1801029433487402fa080a95ed9a",
"md5": "fed747a9ad34776890cda3b484c266ab",
"sha256": "a3b3db293d217fe75cf9ccebe4694e781a93178486c004a008ed4abd6f53bef4"
},
"downloads": -1,
"filename": "sphoin-2.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fed747a9ad34776890cda3b484c266ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 22934,
"upload_time": "2023-04-10T09:55:59",
"upload_time_iso_8601": "2023-04-10T09:55:59.389388Z",
"url": "https://files.pythonhosted.org/packages/b7/80/fe5085385ca69056191bdc7c4b7dee6f1801029433487402fa080a95ed9a/sphoin-2.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "052a20471f48e73b42f7341b69d62c4a031fba567ab15e1ed3bf3a954ef93a02",
"md5": "58f79b50d8a894399d5005d68f630ae2",
"sha256": "0133c3951705c1e4e5fbb199c26c16904eae9a475433781a8639d9613d59ba9f"
},
"downloads": -1,
"filename": "sphoin-2.0.12.tar.gz",
"has_sig": false,
"md5_digest": "58f79b50d8a894399d5005d68f630ae2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17500,
"upload_time": "2023-04-10T09:56:06",
"upload_time_iso_8601": "2023-04-10T09:56:06.861046Z",
"url": "https://files.pythonhosted.org/packages/05/2a/20471f48e73b42f7341b69d62c4a031fba567ab15e1ed3bf3a954ef93a02/sphoin-2.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-10 09:56:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Parsecom",
"github_project": "sphoin",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sphoin"
}