Giter Site home page Giter Site logo

Setup about opencryptobot HOT 24 CLOSED

endogen avatar endogen commented on May 30, 2024
Setup

from opencryptobot.

Comments (24)

Endogen avatar Endogen commented on May 30, 2024 1

Hi,
i'm currently working on the bot and it's not nearly finished so that's why there is no guide yet but it will definitely come soon :-)

If you already want to play around with it, you have to be in the folder you extracted the whole thing into and then you can start it with:

python3 -m opencryptobot.START

You can add some arguments like this:

python3 -m opencryptobot.START -lvl 10

This will for example set logging to DEBUG (more logs)

And yes you have to set your telegram ID in the config file and also the telegram bot token in file bot.token. You will get the token from telegram user "BotFather" while registering a new bot which is necessary to run my bot.

If you need anything else, let me know 👍
Also, if my answer solves your questions, please make sure to close the issue, thanks.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024 1

Oh and you need some Python modules to be able to run the bot. Basically these:

coinmarketcap
python-telegram-bot
watchdog
pandas
plotly
psutil

And you also need orca to be installed in order to be able to generate charts. It's not easy to set the whole thing up but i can't make it any easier i'm afraid...

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024 1

Yeah it's basically pretty hard to get that stuff working properly. But i also run another bot with the same basics on a Ubuntu server so after im home i will try to help you out with that.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024 1

Will read it all later but for the background thing: my_script.sh &

from opencryptobot.

bitog avatar bitog commented on May 30, 2024 1

Thats right, CMC turned into a shitty provider/greedy API provider but lucky we have more options. 😊

Ah cool, just played around with the bg but your right, we font and chart lines should be in white, otherwise its kinda hard to read. But I like the overall look.

Just saw the new commands, liking the /des one. Easy to find out more about coins. 👍

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024 1

Regarding inline-mode: Just found out that it's not that easy. You have to implement another handler for it to work and doesn't have anything todo with already available commands.

I will see if i can come up with something that allows the bot to accept all available commands and return the information as if the user uses the command itself.

You can read more about it here and here is an example

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Hi there,

Thanks for the detailed reply. I figured that you just stared but the bot looks already great. Your little guide helped me a lot to get the bot started however as of right now I am not able to install Orca properly. I am running it on Ubuntu 16 which seems to be a bit more of a struggle. But I will keep trying. Seems like the issue is X11 which can be bypassed with xvfb however I couldn't make that work, yet. I installed it with npm as well as conda, thought there might be a difference but not really. I am also not too sure why my orca folder doesn't even exists after installation. Should be in /home/fs/anaconda3/bin/orca. Also orca --version or orca --help isn't responding. (img) Anyways, I will dig more into it hoping I get this resolved as I really like how your bot is looking so far.

The error I am getting after issuing /c btc looks like the most common one:

If you haven't installed orca yet, you can do so using conda as follows:

    $ conda install -c plotly plotly-orca

Alternatively, see other installation methods in the orca project README at
https://github.com/plotly/orca.

After installation is complete, no further configuration should be needed. 

If you have installed orca, then for some reason plotly.py was unable to
locate it. In this case, set the `plotly.io.orca.config.executable`
property to the full path of your orca executable. For example:

    >>> plotly.io.orca.config.executable = '/path/to/orca'

After updating this executable property, try the export operation again.
If it is successful then you may want to save this configuration so that it
will be applied automatically in future sessions. You can do this as follows:

    >>> plotly.io.orca.config.save() 

If you're still having trouble, feel free to ask for help on the forums at
https://community.plot.ly/c/api/python

Here is the error that was returned by the command
    $ /home/fs/anaconda3/bin/orca --help

[Return code: 1]

Note: When used on Linux, orca requires an X11 display server, but none was
detected. Please install X11, or configure your system with Xvfb. See
the orca README (https://github.com/plotly/orca) for instructions on using
orca with Xvfb.

*edit:
I just figured how I have to access orca, command to check the version seems like:
xvfb-run -a /home/fs/anaconda3/bin/orca --version "$@"
However I am not sure how I can implement that into your bot, not even sure if I am on the right track, lol.

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Hi again,

I actually was just able to get it working, xvfb-run -a python3 -m opencryptobot.STARTdid the trick.

I am now wondering, how can I get that into my systemd file so I can run it in the background as well as on auto boot? Without xvfb-run -a I am simply using:

[Unit]
Description=Telegram-PriceBot
After=multi-user.target
[Service]
WorkingDirectory=/home/fs/Bots/Telegram/OpenCryptoBot
User=fs
Group=fs
ExecStart=/usr/bin/python3.6 -m opencryptobot.START
Type=idle
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

I must say, really impressed by the bot so far, great work!

I have two more questions tho, if you don't mind me asking -- for what are you using webhook and db? As I disabled both / didn't set it up.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

Hi again,

I actually was just able to get it working, xvfb-run -a python3 -m opencryptobot.STARTdid the trick.

I am now wondering, how can I get that into my systemd file so I can run it in the background as well as on auto boot? Without xvfb-run -a I am simply using:

[Unit]
Description=Telegram-PriceBot
After=multi-user.target
[Service]
WorkingDirectory=/home/fs/Bots/Telegram/OpenCryptoBot
User=fs
Group=fs
ExecStart=/usr/bin/python3.6 -m opencryptobot.START
Type=idle
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

Good question! I would really be interested in getting a working systemd file so that i can provide it also with the bot. If you have something working here, let me know. But right now i don't have an answer for you.

But just as an idea: How about creating a bash script with the command xvfb-run -a python3 -m opencryptobot.START in there and then referencing that script in the systemd file? Shouldn't that be sufficient?

Your other questions:

  1. Webhook: You should be able to run the bot in "webhook" mode if you set it up correctly. But i'm not sure since i never got it working 😢 . If you don't enable webhook mode then the but runs per default in "polling" mode.
  • Polling: Polling periodically connects to Telegram's servers to check for new updates
  • Webhook: A Webhook is a URL you transmit to Telegram once. Whenever a new update for your bot arrives, Telegram sends that update to the specified URL.

You can read up on that here

  1. Database: You of course don't need one but if you enable it, then you will have a database file in the folder data (SQLite database). In that database will be two tables: users and commands. If some user enters a command into the bot, the user (with data like username, language-code, first name, last name, ...) will be saved and also the command he entered. This will help to analyze how many users use the bot, at which time and with which commands.

BTW: Good to hear that you like the bot! 😃 If you have ideas how to improve the bot or if you would like to have some interesting features, let me know! I can already tell you that i will add commands to get infos about the following:

  • ROI for a specific coin or list of best / worst ROIs
  • Global data like BTC market dominance, etc.
  • Google Trends graphs so that you can compare entered values --> example
  • Info about ICOs
  • Etc.

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Alright. I will def look into that and will find a way how to send the command in the background. I already checked forever no success yet. Will try PM later today. Will keep you posted.

Thanks for the clarification in terms of webhook and database, makes much more sense now.

I have seen already those empty, promising files in plugins like ROI, trends etc. Sounds awesome, can't wait to see them in action. Google trends sounds really interesting.

Below some things I think might be great:

  • Longs vs shorts on Mex or Bitfinex.
  • Order book of coins.
  • Top/worse performing coins from last 24h -- prob best to take from top100/200 coins.
  • Rank, top 10 coins -- usd value + percentage change.
  • Dark themed charts (just personal preference).
  • If possible, besides volume also MACD/RSI in /c -- however might get a bit too packed, not sure.
  • Rounding USD/EUR values to 3 decimals. In USD charts maybe even numbers (right now it has 8 decimals, see link.

That's all I could think of right now. Keep it up ;)

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Quick update on the background job. Creating a bash file was the key. Simply created a bash file which I than ran with forever.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024
  • Rounding fiat currencies to two decimals will be done for sure! Thanks for that idea
  • I also thought about dark themed charts. It wouldn't be hard to do
  • MACD/RSI will possibly come later
  • Order book will come (although i don't like to just grab that from a single exchange - in general i don't like accessing just one source but right now i wouldn't know what else to access for that data)
  • Top / worst performing and stuff like that will also come

Thanks for the suggestions 👍

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Cool, thanks for the updates. I also thought of maybe removing the BTC value if you call BTC in (/p and /s as its simply redundant.

Btw I really like that you are using Coingecko, such a great service with a great API and lots of coins. You are not using any CMC data, right? As their new pricing model is ridiculous.

I assume the order book cant be pulled form any other API page? But I agree having just one source isn't the best.

I actually looked into dark theming the charts as, couldn't find it. Its still a little labyrinth for me, the entire charts file 😄

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

Well, i still use CMC to get the coin images on the charts but that's not an official API 😄 CMC is total garbage!

i mostly use CoinGecko and CryptoCompare (which is an awesome API but more restricted then CoinGecko). CoinGecko is really cool, i have to agree to that 👍 Nice API.

But if i'm accessing coin stats / prices on my PC then i'm using Coinlib. But i don't like their API.

For order book data i could probably use https://docs.coinapi.io/#order-book. We will see.

Yeah charts are not so easy to understand in the beginning but after a while it's ok to deal with :-)
Black theme is kind of easy:

            paper_bgcolor='rgb(0,0,0)',
            plot_bgcolor='rgb(0,0,0)',

That's what you need 😃 but i'd like to have the font color in white (or something more bright) and i don't know how to do that right now. I will look into that later.

To add the code to ohlc.py add those two lines after line 105:

        fig['layout'].update(
            paper_bgcolor='rgb(0,0,0)',
            plot_bgcolor='rgb(0,0,0)',
            autosize=False,
            width=800,
            height=600,
            margin=go.layout.Margin(
                l=125,
                r=50,
                b=70,
                t=100,
                pad=4
            ))

You can do the same for chart.py. Looks like this. For some reason the coin logos don't look as nice as with a white background...

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Hi there,

I just figured, or at least for me its the case, that non admins / users which never communicated with the bot in DM are not able to get a response from /c /cs /p /s basically all commands besides help and start. Are you experiencing the same or are all users able to get that data from the bot (in a group, in DM it works for everyone).

Have a good day/night.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

That's normal. A bot can not on it's own communicate with a user unless the user activated the bot with /start. Also, the bot should be usable in inline-mode - meaning that (once you accessed the bot with /start) you can write a command i a channel without the bot being inside that channel. But it's not working for me right now. Have to look into that.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

BTW: inline-mode has to be activated with BotFather

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

Latest commit also includes a few things you mentioned regarding charts

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

That's normal. A bot can not on it's own communicate with a user unless the user activated the bot with /start. Also, the bot should be usable in inline-mode - meaning that (once you accessed the bot with /start) you can write a command i a channel without the bot being inside that channel. But it's not working for me right now. Have to look into that.

Oh, I didn't know that. Usually I could solve that issue if I promote the bot to an admin or if I change the bot settings to private mode disabled as the bot than listens to all messages in a group chat. Thats how I always solved that specific issue.

BTW: inline-mode has to be activated with BotFather

Just looked into inline-mode and enabled it as well.

Latest commit also includes a few things you mentioned regarding charts

Nice, just saw it. USD charts are looking much better now 👍

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Hi there,

I was wondering - how does the new inline-mode implementation work? Does it work well?

Sent with GitHawk

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

Hi,
i've played around with it and it does work but it's kind of dirty because it's not meant to execute commands over it and i don't think it will work with commands that reply an image...

if you enabled inline-mode with BotFather, you can get into some group and enter for example

@opencryptobot /p xmr.

then wait a bit and that will result in a popup that you have to click. after that you will get the same result as with the /p command. you can basically use the same stuff as with the command so things like /p usd-xmr work also but you always need to add a dot . at the end.

I will probably remove it at some later point but for now it's there and usable but right now only with the /p command. for it to work you need to slightly change the individual plugin implementations - which i don't like.

from opencryptobot.

Endogen avatar Endogen commented on May 30, 2024

BTW: I like your input but can we move the discussion over to Telegram? We don't have to but i'd like to close the issue since we're past the initial issue 😄

In Telegram: @endogen

from opencryptobot.

bitog avatar bitog commented on May 30, 2024

Hi,
i've played around with it and it does work but it's kind of dirty because it's not meant to execute commands over it and i don't think it will work with commands that reply an image...

if you enabled inline-mode with BotFather, you can get into some group and enter for example

@opencryptobot /p xmr.

then wait a bit and that will result in a popup that you have to click. after that you will get the same result as with the /p command. you can basically use the same stuff as with the command so things like /p usd-xmr work also but you always need to add a dot . at the end.

I will probably remove it at some later point but for now it's there and usable but right now only with the /p command. for it to work you need to slightly change the individual plugin implementations - which i don't like.

Sounds interesting, will play around with it later today. Thank you.

BTW: I like your input but can we move the discussion over to Telegram? We don't have to but i'd like to close the issue since we're past the initial issue 😄

In Telegram: @endogen

Yes, sure. I think that would be better. Will PM you in a bit. Will Close this issue now.

from opencryptobot.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.