Closed velajos closed 3 years ago
In short, what I would like is to be able to receive a notification with a price variable that I can format (like the variable "prices_value", as I showed you in the example) because that way I can get TakeProfit, Stoploss, Entry Price, etc.
But all this, using the Conditional format
Hello @Juanjacinto123, can you share parts of your config.yml
.
Hello @Juanjacinto123, can you share parts of your
config.yml
.
settings: log_level: INFO enable_charts: false update_interval: 300 market_pairs:
exchanges:
binance:
required:
enabled: true
all_pairs:
- USDT
- BTC
indicators:
bbp:
- enabled: true
alert_enabled: true
alert_frequency: once
candle_period: 15m
period_count: 20
hot: -0.10
cold: 0.8
std_dev: 2
signal:
- bbp
- mfi
hot_label: 'Lower Band'
cold_label: 'Upper Band'
indicator_label: 'Cruce BB Inferior en 15m'
mute_cold: true
ma_crossover:
- enabled: true
candle_period: 15m
alert_enabled: true
alert_frequency: always
exponential: true
ma_fast: 13
ma_slow: 34
signal:
- close
hot_label: 'Uptrend is coming'
cold_label: 'Downtred is coming'
indicator_label: 'Cruce EMA 13/34 en 15m'
mute_cold: false
rsi:
- enabled: true
alert_enabled: true
alert_frequency: always
signal:
- rsi
hot: 60
cold: 70
candle_period: 15m
period_count: 14
hot_label: 'Uptrend is coming'
cold_label: 'Downtred is coming'
indicator_label: 'rsi'
mute_cold: false
ma_ribbon:
- enabled: true
alert_enabled: true
alert_frequency: always
signal:
- pval
- corr
hot: 10
cold: -10
hot_label: 'Uptrend is coming'
cold_label: 'Downtred is coming'
candle_period: 1h
pval_th: 20
ma_series: 5, 15, 25, 35, 45
indicator_label: 'Moving Average Ribbon (alcista)'
mute_cold: false
macd:
- enabled: false
iiv:
- enabled: false
alert_enabled: true
alert_frequency: once
signal:
- iiv
hot: 1
cold: 0
candle_period: 15m
stoch_rsi:
- enabled: false
momentum:
- enabled: false
obv:
- enabled: false
mfi:
- enabled: false
ichimoku:
- enabled: false
informants: lrsi:
@w1ld3r I would also like to know what is the optimal configuration for these values in this section:
settings:
update_interval: 300 start_worker_interval: 60 market_data_chunk_size: 20
Taking into account that all my alerts are programmed for candles of 15m.
Hello @Juanjacinto123, can you share parts of your
config.yml
.
Without this:
conditionals:
The script works perfectly
update_interval = number of second to wait after a worker has finish his work
start_worker_interval = number of second to wait between each start of workers
market_data_chunk_size = number of pair a worker will work on
By setting market_data_chunk_size
at 1, you will have a worker per pair, allowing to get result quicker but, it's using more RAM, CPU an bandwidth.
Hello @Juanjacinto123, can you share parts of your
config.yml
.Without this:
conditionals:
* label: "Signal to buy" hot: * ma_crossover: 0 * ma_ribbon: 0 * label: "Signal to buy" hot: * rsi: 0 * bbp: 0
The script works perfectly
I'm going to implement it. I will push it tomorrow.
Hello @Juanjacinto123, can you share parts of your
config.yml
.Without this: conditionals:
* label: "Signal to buy" hot: * ma_crossover: 0 * ma_ribbon: 0 * label: "Signal to buy" hot: * rsi: 0 * bbp: 0
The script works perfectly
I'm going to implement it. I will push it tomorrow.
Great W1ld3r, Thank you very much, I will look forward it
Which branch is working with price_value
?
Next time, please, use a template to facilitate the resolution.
Which branch is working with
price_value
?
I think I don't understand your question very well.
But everything is working fine with price_value, provided that I don't use the Conditionals.
I would like to keep using the price_value because this variable allows applying format in the Template of Notifiers, like this:
"{{ decimal_format|format(price_value.close * 1.06) }}"
But if I use price_value with Conditional simultaneously, I get the error: "price_value" is undefined on jinja2
I explain myself well?
Which branch is working with
price_value
?
Sorry, I already understood your question.
I am using your develop branch.
There will be a problem enabling this functionnality for conditional. Because conditional can be on different candle period. So what ohlcv period I kept, when the condition is on multiple candle period ?
There will be a problem enabling this functionnality for conditional. Because conditional can be on different candle period. So what ohlcv period I kept, when the condition is on multiple candle period ?
Well in the case that conditional involves several candles, I think that the most logical thing would be to show the results for candles in a lower temporality. If you have 1h and 15m, then the Price_Value should be shown for the 15m candle, as it would be the closest at the live moment.
I making it agnostic, allowing user to choose the candle periode like this:
template: "{{ price_value['15m'].low }} {{ price_value['1d'].high }}"
I just have to check for side effects, update Readme and make more test.
I making it agnostic, allowing user to choose the candle periode like this:
template: "{{ price_value['15m'].low }} {{ price_value['1d'].high }}"
I just have to check for side effects, update Readme and make more test.
If User could choose, it would be great.
Let me know to test it and give you my results
I've push change to the new develop_variable_price
branch, let me know if you have issue.
PS: don't miss to take a look at the Readme. You can no longer use decimal_format|format()
.
I've push change to the new
develop_variable_price
branch, let me know if you have issue. PS: don't miss to take a look at the Readme. You can no longer usedecimal_format|format()
.
I have tried both versions and I keep getting the following errors:
Using this form: Price 15m low: [{{prices['15m'].low}}]
I got this Error:
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 471, in getattr return getattr(obj, attribute) jinja2.exceptions.UndefinedError: 'str object' has no attribute '15m'
Using this form: Price 15m low: [{{price_value['15m'].low}}]
I got this Error:
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 452, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'price_value' is undefined
The error:
Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "app.py", line 100, in run self.behaviour.run(self.market_data, self.settings['output_mode']) File "/app/behaviour.py", line 74, in run self.notifier.notify_all(new_result) File "/app/notification.py", line 154, in notify_all self.notify_conditional(exchange, market_pair, _messages) File "/app/notification.py", line 204, in notify_conditional self.notify_telegram([new_message], None) File "/app/notification.py", line 310, in notify_telegram formatted_messages.append(message_template.render(message)) File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 3, in top-level template code File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 452, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'price_value' is undefined
Have you change git branch ? (git checkout develop_variable_price
)
Here is a conf file I was using during testing:
settings:
log_level: INFO
update_interval: 300
start_worker_interval: 2
market_data_chunk_size: 1
timezone: Europe/Berlin
exchanges:
binance:
required:
enabled: true
all_pairs:
- BTC
indicators:
bbp:
- enabled: false
ma_crossover:
- enabled: false
rsi:
- enabled: true
alert_enabled: true
alert_frequency: always
signal:
- rsi
hot: 100
cold: 0
candle_period: 15m
period_count: 14
mute_cold: false
- enabled: true
alert_enabled: true
alert_frequency: always
signal:
- rsi
hot: 100
cold: 0
candle_period: 1h
period_count: 14
mute_cold: false
ma_ribbon:
- enabled: false
macd:
- enabled: false
iiv:
- enabled: false
stoch_rsi:
- enabled: false
momentum:
- enabled: false
obv:
- enabled: false
mfi:
- enabled: false
ichimoku:
- enabled: false
informants:
lrsi:
- enabled: false
sma:
- enabled: false
ema:
- enabled: false
vwap:
- enabled: false
bollinger_bands:
- enabled: false
ohlcv:
- enabled: true
signal:
- high
- low
- close
- open
candle_period: 15m
period_count: 20
- enabled: true
signal:
- high
- low
- close
- open
candle_period: 1h
period_count: 20
conditionals:
- label: "Buy"
hot:
- rsi: 0
- rsi: 1
- label: "Sell"
cold:
- rsi: 0
- rsi: 1
notifiers:
telegram:
required:
token: AAAA
chat_id: BBBB
optional:
parse_mode: html
template: "{{ market }}
BUY {{ price_value['1h'].close }}
SL: {{ price_value['15m'].low * 0.9 }}
TP: {{ price_value['1h'].close * 1.02 }} {{ price_value['15m'].close * 1.04 }} "
Here is a conf file I was using during testing:
settings: log_level: INFO update_interval: 300 start_worker_interval: 2 market_data_chunk_size: 1 timezone: Europe/Berlin exchanges: binance: required: enabled: true all_pairs: - BTC indicators: bbp: - enabled: false ma_crossover: - enabled: false rsi: - enabled: true alert_enabled: true alert_frequency: always signal: - rsi hot: 100 cold: 0 candle_period: 15m period_count: 14 mute_cold: false - enabled: true alert_enabled: true alert_frequency: always signal: - rsi hot: 100 cold: 0 candle_period: 1h period_count: 14 mute_cold: false ma_ribbon: - enabled: false macd: - enabled: false iiv: - enabled: false stoch_rsi: - enabled: false momentum: - enabled: false obv: - enabled: false mfi: - enabled: false ichimoku: - enabled: false informants: lrsi: - enabled: false sma: - enabled: false ema: - enabled: false vwap: - enabled: false bollinger_bands: - enabled: false ohlcv: - enabled: true signal: - high - low - close - open candle_period: 15m period_count: 20 - enabled: true signal: - high - low - close - open candle_period: 1h period_count: 20 conditionals: - label: "Buy" hot: - rsi: 0 - rsi: 1 - label: "Sell" cold: - rsi: 0 - rsi: 1 notifiers: telegram: required: token: AAAA chat_id: BBBB optional: parse_mode: html template: "{{ market }} BUY {{ price_value['1h'].close }} SL: {{ price_value['15m'].low * 0.9 }} TP: {{ price_value['1h'].close * 1.02 }} {{ price_value['15m'].close * 1.04 }} "
Is now Working!
Price_value results are displayed as scientific notation and it is difficult to read data in this format.
Could you add the decimal format option? It is easier to perform operations in this format.
You could also leave this option to the user's choice.
For example, in the case of BTC pairs are displayed in scientific notation, for this case, the decimal format between 8 and 10 decimals would be the most convenient.
I've tested the output with {{ price_value['15m'].close }}
and decimal_format|format(price_value.close)
, it's the same.
Without the format:
0.072196
With the format decimal:
0.072074
You have the same number of decimal.
I've tested the output with
{{ price_value['15m'].close }}
anddecimal_format|format(price_value.close)
, it's the same. Without the format:0.072196
With the format decimal:
0.072074
You have the same number of decimal.
This is an example:
Indicator: Ema 12/34 Pair: Fun/BTC
BUY: 5.9e-07 TP1: 6.018e-07 TP2: 6.135999999999999e-07 TP3: 6.254e-07
SL: 5.811499999999999e-07
Other one:
Indicator: Signal to rsi Pair: LRC/BTC
BUY: 9.87e-06 TP1: 1.0067400000000001e-05 TP2: 1.02648e-05 TP3: 1.0462200000000001e-05
SL: 9.721950000000001e-06
Sometimes I receive more decimal places for the same pair, as in the following example: Par: EGLD/BTC BUY: 0.002687 TP1: 0.00274074 TP2: 0.0027944800000000002 TP3: 0.0028482200000000003 SL: 0.002646695
Par: EGLD/BTC BUY: 0.002669 TP1: 0.00272238 TP2: 0.00277576 TP3: 0.00282914 SL: 0.002628965
I found one solution for now:
{{ '%.2E' % price_value['15m'].close }}
Like that you will alway have scientific notation.
I found one solution for now:
{{ '%.2E' % price_value['15m'].close }}
Like that you will alway have scientific notation.
OK I will try it. I will let you know. Thanks
You can adjust the x in %.xE
to satisfy your needs. With %.2E
you will have two decimal.
Never mind, I've understood. Let me update the develop_variable_price
branch.
You can git pull
new changes from the develop_variable_price
branch. It fix the {{ decimal_format|format(x) }}
issue.
Let me know when it's good for you. Like that I'll merge develop_variable_price
changes to the develop
branch.
You can
git pull
new changes from thedevelop_variable_price
branch. It fix the{{ decimal_format|format(x) }}
issue.
I'm sorry, I wouldn't know how to do it correctly
You can adjust the x in
%.xE
to satisfy your needs. With%.2E
you will have two decimal.
It works, but as I mentioned, the decimal format is more optimal for the code.
Let me know when it's good for you. Like that I'll merge
develop_variable_price
changes to thedevelop
branch.
At the moment everything works fine, except for the {{ decimal_format|format(x) }} issue.
Let me know when it's good for you. Like that I'll merge
develop_variable_price
changes to thedevelop
branch.
If you say that once you merge "develop_variable_price" with "develop", it would solve the "{{decimal_format | format (x)}}" issue, I think you could do it and that way test it
Changes as been merged to the develop
branch. You just have to follow the steps bellow:
cd <to_crypto_signal_directory>
git checkout develop
git pull
Changes as been merged to the
develop
branch. You just have to follow the steps bellow:cd <to_crypto_signal_directory> git checkout develop git pull
I have changed to develop and I got the error again:
Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "app.py", line 100, in run self.behaviour.run(self.market_data, self.settings['output_mode']) File "/app/behaviour.py", line 74, in run self.notifier.notify_all(new_result) File "/app/notification.py", line 154, in notify_all self.notify_conditional(exchange, market_pair, _messages) File "/app/notification.py", line 204, in notify_conditional self.notify_telegram([new_message], None) File "/app/notification.py", line 310, in notify_telegram formatted_messages.append(message_template.render(message)) File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render self.environment.handle_exception() File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 5, in top-level template code File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 455, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'price_value' is undefined
Sorry, I miss the merge yesterday. Can you try, now, after pulling new changes from the develop branch ?
Sorry, I miss the merge yesterday. Can you try, now, after pulling new changes from the develop branch ?
Ok, Now I will try
Sorry, I miss the merge yesterday. Can you try, now, after pulling new changes from the develop branch ?
I tried and works, but when aplied this: TP1: {{ decimal_format|format(price_value['15m'].close) * 1.02
I got this error:
Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "app.py", line 100, in run self.behaviour.run(self.market_data, self.settings['output_mode']) File "/app/behaviour.py", line 74, in run self.notifier.notify_all(new_result) File "/app/notification.py", line 154, in notify_all self.notify_conditional(exchange, market_pair, _messages) File "/app/notification.py", line 206, in notify_conditional self.notify_telegram([new_message], None) File "/app/notification.py", line 311, in notify_telegram formatted_messages.append(message_template.render(message)) File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render self.environment.handle_exception() File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 6, in top-level template code TypeError: can't multiply sequence by non-int of type 'float'
You have to make the multiplication in the format function like this:
TP1: {{ decimal_format|format(price_value['15m'].close * 1.02) }}
You have to make the multiplication in the format function like this:
TP1: {{ decimal_format|format(price_value['15m'].close * 1.02) }}
Great, You are awesome my friend
I have another small question:
Is there any way to detect a relative price change between several candles?
For example: When there is a 10% change in price between 30 consecutive 1m candles.
I don't think crypto-signal has this functionality for now. Maybe ask here https://github.com/CryptoSignal/Crypto-Signal
I don't think crypto-signal has this functionality for now. Maybe ask here https://github.com/CryptoSignal/Crypto-Signal
Thank you very much
Hi !!
I have test the branch develop with the new changes, but I got this error:
Traceback (most recent call last):
_File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "app.py", line 100, in run
self.behaviour.run(self.market_data, self.settings['output_mode'])
File "/app/behaviour.py", line 74, in run
self.notifier.notify_all(new_result)
File "/app/notification.py", line 160, in notify_all
self.notify_all_messages(
File "/app/notification.py", line 228, in notify_all_messages
self.notify_telegram(messages, chart_file)
File "/app/notification.py", line 311, in notify_telegram
formatted_messages.append(message_template.render(message))
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 474, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute '15m'
Its my config file :
ohlcv:
- enabled: true
signal:
- high
- low
- close
- open
candle_period: 15m
period_count: 20
- enabled: true
signal:
- high
- low
- close
- open
candle_period: 1h
period_count: 20
notifiers:
telegram:
required:
token: xxxxx
chat_id: -xxxxx
optional:
parse_mode: html
template: " [{{analysis.config.candle_period}} / {{analysis.config.period_count}}] {{market}}-{{indicator}}-{{indicator_number}} {{indicator_label}} **{{hot_cold_label}}** {{values}}) Prices: {{prices}} TP: {{ decimal_format|format(price_value['15m'].close * 1.015) }}"
I removed all directories "pycache" and I dont know what happened, could you help me ? Thank you !!
Ok, I got it, without conditionals not works : { decimal_format|format(price_value['5m'].close * 0.95) }}
Its normal? Ty again :)
Yes it normal. This fork is for conditional use.
Hello, I have problems when I use the Conditionals.
When I have the "prices_value" activated on the Template in the Notifiers section, I receive this error:
"price_value" is undefined on jinja2
Example:
File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "", line 2, in top-level template code File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 471, in getattr return getattr(obj, attribute) jinja2.exceptions.UndefinedError: 'pricevalue' is undefined
Without Conditionals "prices_value" is working good @w1ld3r
Also {{prices}} works, but with {{prices}} I can't format as I do with the variable "price_value".
Example:
notifiers: telegram: required: token: xxxxxxxxAFssBkCdO3q5KZvgwxxxxxxx chat_id: -1xxxxxxx optional: parse_mode: html template: "Indicator: {{indicator_label}} {{ '\n' -}} Par: {{market}} {{ '\n' -}} {{ '\n' -}} SIGNAL: {{ '\n' -}} BUY: {{ decimal_format|format(price_value.close) }} {{ '\n' -}} TP1: {{ decimal_format|format(price_value.close 1.02) }} {{ '\n' -}} TP2: {{ decimal_format|format(price_value.close 1.04) }} {{ '\n' -}} SL: {{ decimal_format|format(pricevalue.low * 0.985) }} "
What can I do to solve this problem? Or how Can I get the price in the notification (I use Telegram).
Thanks