Skip to content

Commit

Permalink
Adding building folder of datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanvz committed Feb 25, 2022
1 parent 8185231 commit 687f641
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo snap install code --classic
```
* Install the visual studio code extension "Remote - Containers" -->
### Installation
### Building

Follow the next steps:

Expand All @@ -121,7 +121,15 @@ Follow the next steps:
```
<p align="right">(<a href="#top">back to top</a>)</p>

### Intalling

Just need to use pip with git command:
```python
pip install git+https://github.com/estebanvz/crypto_price.git
```

### Usage

Get the keys from API Binance:

[GET BINANCE API KEYS](https://www.binance.com/en/support/faq/360002502072)
Expand Down
7 changes: 6 additions & 1 deletion src/crypto_price/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ class CryptoDataExtractor:
def __init__(self, save_path="./datasets", criptos=["BTCUSDT"]) -> None:
self.save_path = save_path
self.criptos = criptos
if(os.path.isdir(self.save_path) is False):
os.mkdir(self.save_path)

def from_binance(
self, api_key="", api_secret="", time_in_hours=24, time_interval="1h"
):
time_folder = "{}/{}".format(self.save_path, time_interval)
if(os.path.isdir(time_folder) is False):
os.mkdir(time_folder)
client = Client(api_key, api_secret)
client.API_URL = BINANCE_API

Expand All @@ -29,7 +34,7 @@ def from_binance(
bars = client.get_historical_klines(cripto, time_interval, unixtime)
if not len(bars) == 0:
np.savetxt(
"{}/{}/{}.csv".format(self.save_path, time_interval, cripto),
"{}/{}.csv".format(time_folder, cripto),
bars,
delimiter="|",
fmt="%s",
Expand Down

0 comments on commit 687f641

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy