Skip to content

Commit

Permalink
adding bucket parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanvz committed Oct 29, 2023
1 parent 5b9cb0e commit f554f15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/crypto_price/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def save_numpy_array_to_gcs(bucket_name, file_name, numpy_array):
print(f"NumPy array saved to {bucket_name}/{file_name} in Google Cloud Storage")

class CryptoDataExtractor:
def __init__(self, save_path, criptos=["BTCUSDT"], gcp = True) -> None:
def __init__(self, save_path, criptos=["BTCUSDT"], gcp = True, bucket="") -> None:
self.save_path = save_path
self.bucket = bucket
self.gcp = gcp
self.criptos = criptos
if(self.gcp is False):
Expand All @@ -56,7 +57,7 @@ def from_binance(
bars = client.get_historical_klines(cripto, time_interval, unixtime)
if len(bars) >= 60:
if(self.gcp):
save_numpy_array_to_gcs(self.save_path,f"{bucketTime}-{cripto}",bars)
save_numpy_array_to_gcs(self.bucket,f"{self.save_path}/{bucketTime}-{cripto}",bars)
else:
np.savetxt(
"{}/{}.csv".format(time_folder, cripto),
Expand Down

0 comments on commit f554f15

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