-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed price without candle #16
Comments
Hello, @maximedotair! Thanks for the question. There is no separate command or method for this right now, but I came up with 2 workarounds for you. See which of these is more easy for your task:
Let me know if it helped you. Let's try the 1st case. Here is an example of generate 20 candles with 15-min timeframe and started at 2022-10-22 12:00: Command
Here is generated .csv-data: test.csv
And then delete some columns: Let's try the 2nd case. Here is code example that generates 20 candles with 15-min timeframe and started at 2022-10-22 12:00 as in 1st scenario: Code blockimport pandas as pd
from pricegenerator.PriceGenerator import PriceGenerator, uLogger
from datetime import datetime, timedelta
uLogger.setLevel(10) # set debug level
# --- generates 20 candles with 15-min timeframe and started at 2022-10-22 12:00:
# `--debug-level 10 --precision 2 --timeframe 15 --start "2022-10-22 12:00" --horizon 20 --generate --save-to test.csv`
priceModel = PriceGenerator()
priceModel.precision = 2
priceModel.timeframe = timedelta(minutes=15)
priceModel.timeStart = datetime.now().replace(year=2022, month=10, day=22, hour=12, minute=0, second=0, microsecond=0)
priceModel.horizon = 20
# Generating candles as pandas dataframe, after that class field `prices` contains columns: datetime open high low close volume
priceModel.Generate()
# 1) Edit dataframe if you want: keep only date, time and close columns:
priceModel.prices = priceModel.prices.drop(labels=["open", "high", "low", "volume"], axis=1)
uLogger.info("Keep only datetime and close columns:")
for line in pd.DataFrame.to_string(priceModel.prices[-5:], max_cols=20).split("\n"):
uLogger.info(line)
# 2) Or just edit `csvHeaders` class field and then save csv-file, instead of using 1)
priceModel.csvHeaders = ["date", "time", "close"] # control what columns are saved
priceModel.SaveToFile(fileName="closePrices.csv") Run script. Log
Output csv-file: closePrices.csv
Here is the result: |
Implement since build v1.3.dev78 Debug build: https://app.travis-ci.com/github/Tim55667757/PriceGenerator/builds/259412521 |
is it possible to generate fixed price points over a period of time, without candle?
The text was updated successfully, but these errors were encountered: