[Feature Request] Crypto Prices #4

Closed
opened 2019-05-15 02:35:46 +02:00 by dicijr · 9 comments
dicijr commented 2019-05-15 02:35:46 +02:00 (Migrated from github.com)

Anyway to implement crypto prices instead of RSS feed?

Been trying to reverse-engineering it, but it hasn't been easy. Any guidance?

Anyway to implement crypto prices instead of RSS feed? Been trying to reverse-engineering it, but it hasn't been easy. Any guidance?
mgfcf commented 2019-05-15 08:53:36 +02:00 (Migrated from github.com)

Currently, only the title of a RSS post is printed in a line, preceded by a dot. If you know any source that provides the desired information in such a format, where everything important is mentioned in the title, you could simply add those to the rss_feeds. That is probably not the case.
To help you, I need to know how and what information should be presented (Name of the currency, current value, maybe the latest change?) and what the source looks like. Are there some RSS-Feed similiar links? Should an additional python package be used?
I don't know much about the stock market, currrencies and all of that, but I imagine that stock and currency are related enough, so that they can be merged together into one feature somehow?

Currently, only the title of a RSS post is printed in a line, preceded by a dot. If you know any source that provides the desired information in such a format, where everything important is mentioned in the title, you could simply add those to the rss_feeds. That is probably not the case. To help you, I need to know how and what information should be presented (Name of the currency, current value, maybe the latest change?) and what the source looks like. Are there some RSS-Feed similiar links? Should an additional python package be used? I don't know much about the stock market, currrencies and all of that, but I imagine that stock and currency are related enough, so that they can be merged together into one feature somehow?
dicijr commented 2019-05-15 20:00:18 +02:00 (Migrated from github.com)

I'm not a python dev, but I have some webdev skills. I understand the theory, its just the whole adapting to someone elses code is a little hard for me but I'm sure we can work together here!

https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=USD

Heres an example of an API pull from coingecko. Perhaps we could find a source that has both stocks and crypto but coingecko provides a free API (w/o token) if you can help me develop into something..

https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,litecoin&vs_currencies=USD

would be both btc and ltc

I'm not a python dev, but I have some webdev skills. I understand the theory, its just the whole adapting to someone elses code is a little hard for me but I'm sure we can work together here! https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=USD Heres an example of an API pull from coingecko. Perhaps we could find a source that has both stocks and crypto but coingecko provides a free API (w/o token) if you can help me develop into something.. https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,litecoin&vs_currencies=USD would be both btc and ltc
mgfcf commented 2019-05-16 09:05:44 +02:00 (Migrated from github.com)

That looks great! Thanks for your research! I will work on this asap, which basically means tomorrow :D

To give some more insight into my code:
Every information (except datetime) comes from a specific class. Weather comes from OwmForecast, RSS Feeds from RssParserPosts and Events from IcalEvents. But everyone of those "data classes" inherits from an abstract data class (OwmForecast => WeatherInterface, IcalEvents => CalendarInterface, ...) and they all inherit from the abstract DataSourceInterface class (CalendarInterface => DataSourceInterface).
For the currencies that would make something like GeckoCurrency => CurrencyInterface => DataSourceInterface to provide all the functionality needed.
But you don't need to implement it that technically. You could, if you want, create one general class/collection of functions/function that collects all necessary data and transforms it into an according data object.
Every type of information is packed into its own data object class, to use data in a coherent manner. Weather is transported in a WeatherForecast object, RSS-Posts are transported in a RssPost object and events are transported in a CalendarEvent object.

Later on, every panel (a whole, finished design) needs to have somekind of function to take those information/data objects. The PanelDesign class is the basis of every design and defines the interface. A function like "add_currency" would be needed.

As you can see, I probably overcomplexified it a little bit, but on the other hand it is easier to add new things without disrupting the rest of the code. I am planning to refactor that system a little bit to make it cleaner and reduce duplicated code.

I will have a closer look tomorrow and feel free to explore the code and implement new features.

That looks great! Thanks for your research! I will work on this asap, which basically means tomorrow :D To give some more insight into my code: Every information (except datetime) comes from a specific class. Weather comes from OwmForecast, RSS Feeds from RssParserPosts and Events from IcalEvents. But everyone of those "data classes" inherits from an abstract data class (OwmForecast => WeatherInterface, IcalEvents => CalendarInterface, ...) and they all inherit from the abstract DataSourceInterface class (CalendarInterface => DataSourceInterface). For the currencies that would make something like GeckoCurrency => CurrencyInterface => DataSourceInterface to provide all the functionality needed. But you don't need to implement it that technically. You could, if you want, create one general class/collection of functions/function that collects all necessary data and transforms it into an according data object. Every type of information is packed into its own data object class, to use data in a coherent manner. Weather is transported in a WeatherForecast object, RSS-Posts are transported in a RssPost object and events are transported in a CalendarEvent object. Later on, every panel (a whole, finished design) needs to have somekind of function to take those information/data objects. The PanelDesign class is the basis of every design and defines the interface. A function like "add_currency" would be needed. As you can see, I probably overcomplexified it a little bit, but on the other hand it is easier to add new things without disrupting the rest of the code. I am planning to refactor that system a little bit to make it cleaner and reduce duplicated code. I will have a closer look tomorrow and feel free to explore the code and implement new features.
dicijr commented 2019-05-17 07:57:34 +02:00 (Migrated from github.com)

Defintely got somewhere. Just need to get the prices to display one row, instead of like this:

$8
$8
$.
$4
$7

Defintely got somewhere. Just need to get the prices to display one row, instead of like this: $8 $8 $. $4 $7
mgfcf commented 2019-05-17 09:15:20 +02:00 (Migrated from github.com)

To display information in rows or just one row, you should use the TableDesign. Simply create a matrix in the format:

[  COL v
    [ cell, cell, cell ],   <= ROW
    [ cell, cell, cell ]
]

In the constructor of TableDesign you can set a variety of design options like the alignment of the content, font size and color for each cell. These information are passed to the parameter cell_properties which receives a matrix in the form of the content-matrix, but each cell is replaced with a dictionary that describes each parameter of the cell:

default_props = {
    "color" : colors["fg"],
    "background_color" : colors["bg"],
    "font-size" : defaultfontsize
}

If no dictionary is given, these default values are used.
Alignment settings are passed over to column_horizontal_alignments as a list with the length of the amount of columns and texts, describing the horizontal alignment ("left", "center", "right") for each column.

To display information in rows or just one row, you should use the TableDesign. Simply create a matrix in the format: ``` [ COL v [ cell, cell, cell ], <= ROW [ cell, cell, cell ] ] ``` In the constructor of TableDesign you can set a variety of design options like the alignment of the content, font size and color for each cell. These information are passed to the parameter `cell_properties` which receives a matrix in the form of the content-matrix, but each cell is replaced with a dictionary that describes each parameter of the cell: ``` default_props = { "color" : colors["fg"], "background_color" : colors["bg"], "font-size" : defaultfontsize } ``` If no dictionary is given, these default values are used. Alignment settings are passed over to `column_horizontal_alignments` as a list with the length of the amount of columns and texts, describing the horizontal alignment ("left", "center", "right") for each column.
dicijr commented 2019-05-17 09:17:36 +02:00 (Migrated from github.com)

I definitely got some progress. The code definitely isn't beautiful or stable... but might need your help on some of this.

I definitely got some progress. The code definitely isn't beautiful or stable... but might need your help on some of this.
mgfcf commented 2019-05-17 09:33:27 +02:00 (Migrated from github.com)

I would like to help :D Could you push your files to your fork or share them somehow?

I would like to help :D Could you push your files to your fork or share them somehow?
dicijr commented 2019-05-17 09:59:38 +02:00 (Migrated from github.com)

I'll upload them now. I'll sort of try to brief you i nthe commit

I'll upload them now. I'll sort of try to brief you i nthe commit
dicijr commented 2019-05-17 10:09:03 +02:00 (Migrated from github.com)

2 sep commits, one has my comment. Have fun!

2 sep commits, one has my comment. Have fun!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: m.giller/E-Paper-Calendar#4
No description provided.