Bitcoin Forum
May 06, 2024, 09:08:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 [All]
  Print  
Author Topic: [In-Development] BitPrice.link - Live Bitcoin/Crypto Calculator! [Open-Source]  (Read 2675 times)
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 14, 2016, 07:56:47 AM
Last edit: October 19, 2016, 06:11:07 AM by Decoded
 #1

I'm currently building a site based on the same idea as preev.com.

It would be awesome if you guys could come up with ideas and even help with the site!

https://www.github.com/Sir-Lagsalot/BitPrice

Planned Features:
 - Wide range of exchanges
 - Faster than preev
 - More exchange options than preev
 - Email updates
 - Bitcoin stats

Status

Right now it's very primitive, and only works on the default BTC to USD. Cannot choose exchanges, but is an average of 17 different exchanges.

looking for a signature campaign, dm me for that
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
MartinL
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
October 14, 2016, 08:43:50 AM
 #2

I suggest releasing the source code now if your goal is to do that eventually anyways. That way anyone interested in helping can go right ahead and submit patches without any commitment.
batesresearch
Legendary
*
Offline Offline

Activity: 2424
Merit: 1147


View Profile WWW
October 14, 2016, 09:41:18 AM
 #3

I am actually building a similar site but for personal use only (family and friends) my end goal is to have a site much like Preev but auto converting the cryptos I trade and possibly having a portfolio section.

Not sure I will be any help but am happy to help where I can.

Visit Satoshi's Place, a Bitcoin Hub based in Bury, Manchester, UK.
Website: https://satoshisplace.co.uk
Goals: Educate & Onboard users in to Bitcoin. Lightning network⚡️
cloverme
Legendary
*
Offline Offline

Activity: 1512
Merit: 1054


SpacePirate.io


View Profile WWW
October 14, 2016, 03:02:39 PM
 #4

It's not working for me at the moment, but maybe you're working it today.  The site loads but I don't think the javascript is firing correctly on your key event. Your bitcoinprices variable may need to be initialized before using it in a calculation.


Chrome Version 54.0.2840.59 beta-m (64-bit)
Code:
Uncaught ReferenceError: bitcoinprices is not defined
    at update (http://52.62.67.167/Assets/JS/update.js:4:24)
    at HTMLInputElement.onkeyup (http://52.62.67.167/:20:86)

tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1530



View Profile
October 14, 2016, 04:12:14 PM
 #5

Fetching the prices of different exchanges is not really a big deal. This can be done by writing a few lines of code. Everyone major exchanges offers a public to use API for fetching the current price and / or order books. Then, you just need to get the fiat rates. You may use the free API of Yahoo finance for that. I do not really see why there must set up an open source project for this kind of project.
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
October 14, 2016, 06:12:23 PM
 #6

I do not really see why there must set up an open source project for this kind of project.
Yeah,what if someone just wants to experiment with stuff? Or maybe learn the basics ? If it all works out like it's suppose to be,I think the project does have the potential to become the most used or accurate price ticker for trades.

Op,like the UI,what framework are you using? Pretty sleek!I can help you with the UI/Javascript,please update the code on github and inbox me once it's done.I've too much time on my hands lately.
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 15, 2016, 03:40:00 AM
 #7

I need help with the JavaScript. I have already set up backend price chaching. I just need help with innerhtml.

What parts of the JavaScript do you need help with? By innerhtml, do you mean doing the live interaction with the user? Here's a super basic barebones example I put together with just BTC/USD that might help.

https://github.com/coinables/Bitcoin-USD-Price-Conversion-Tool/blob/master/js/price.js


Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 15, 2016, 05:59:43 AM
 #8

Nice to see all this interest.

Yeah, I got a friend to write some example code for me that I tested out, but unfortunately is slightly broken. Soon I'm going to stop it from running on my VPS and make the git repo public. Will edit the OP.

I need help with the JavaScript. I have already set up backend price chaching. I just need help with innerhtml.

What parts of the JavaScript do you need help with? By innerhtml, do you mean doing the live interaction with the user? Here's a super basic barebones example I put together with just BTC/USD that might help.

https://github.com/coinables/Bitcoin-USD-Price-Conversion-Tool/blob/master/js/price.js

I know the js to get the price to auto-update into a div, however for me it refuses it auto-update in the input box.

For now, I've set up a weighted average of multiple different exchanges and their bitcoin valurs, you can find it at /api/btc/usd.php and /api/usd/eur.php.

What I want the JS to do is to read the dropdown of the left text box and the value of the right dropdoen, and then get the output value from 52.62.67.167/api/*leftdropdown*/*rightdropdown*.php, multiply it by the left text box and spit it out into the right text box.

For example, to get 1 BTC = *** USD:

Fetch output from 52.62.67.167/api/btc/usd.php, multiply it by 1, then print it out where *** is.


I do not really see why there must set up an open source project for this kind of project.
Yeah,what if someone just wants to experiment with stuff? Or maybe learn the basics ? If it all works out like it's suppose to be,I think the project does have the potential to become the most used or accurate price ticker for trades.

Op,like the UI,what framework are you using? Pretty sleek!I can help you with the UI/Javascript,please update the code on github and inbox me once it's done.I've too much time on my hands lately.


Semantic UI for the dropdowns, everything else is my own.


looking for a signature campaign, dm me for that
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 15, 2016, 06:10:09 AM
 #9

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)

looking for a signature campaign, dm me for that
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
October 15, 2016, 07:17:30 AM
 #10

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 15, 2016, 11:14:59 AM
 #11

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.

Not SirLagsalot, but Sir_Lagsalot.

I do agree that currently the system for getting the exchange rate is primitive. It was just a test to get the JavaScript working. I aim to have all the processing and retrieving done on the backend and not using an external api.

looking for a signature campaign, dm me for that
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 15, 2016, 04:55:49 PM
Last edit: October 15, 2016, 05:09:46 PM by coinableS
 #12

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.

Holy smokes! Python, PHP and NodeJS? There really is no reason to have 3 different server-side languages running at once. If you want one of your features to be "faster than preev" you'll need to cut down on the bloat. For example your node_modules directory is full of modules you aren't using.

What are you most experienced in? I'm guessing PHP based on the current source... My suggestion is you pick one server-side language and go with that, don't jump back and forth.

You can create one file that grabs all the necessary prices every N seconds and then stores them in a database. Then when doing the calculations for the users just pull from the database. You'll have the speed you want, and you won't have to worry about exceeding API request limits with the exchanges you are hitting.

Quote
I know the js to get the price to auto-update into a div, however for me it refuses it auto-update in the input box

For updating a div you typically do something like:

Code:
var myTarget = document.getElementById("myDiv");
myTarget.innerHTML = "My Text";

For updating an input box you need to change it from innerhtml to value.

Code:
var myTarget = document.getElementById("myInputBox");
myInputBox.value = "My Text";

arunka71
Sr. Member
****
Offline Offline

Activity: 410
Merit: 257


View Profile
October 15, 2016, 08:14:18 PM
 #13

I wrote something similar a while ago to run as an app (should also work on a server, since it's using phonegap):

https://bitcointalk.org/index.php?topic=135392.0

Just some JS to fetch the data and create a HTML table from it.
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 15, 2016, 10:42:19 PM
 #14

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.

Holy smokes! Python, PHP and NodeJS? There really is no reason to have 3 different server-side languages running at once. If you want one of your features to be "faster than preev" you'll need to cut down on the bloat. For example your node_modules directory is full of modules you aren't using.

What are you most experienced in? I'm guessing PHP based on the current source... My suggestion is you pick one server-side language and go with that, don't jump back and forth.

You can create one file that grabs all the necessary prices every N seconds and then stores them in a database. Then when doing the calculations for the users just pull from the database. You'll have the speed you want, and you won't have to worry about exceeding API request limits with the exchanges you are hitting.

Quote
I know the js to get the price to auto-update into a div, however for me it refuses it auto-update in the input box

For updating a div you typically do something like:

Code:
var myTarget = document.getElementById("myDiv");
myTarget.innerHTML = "My Text";

For updating an input box you need to change it from innerhtml to value.

Code:
var myTarget = document.getElementById("myInputBox");
myInputBox.value = "My Text";


I figured as much. I was told by a friend that PHP when compared to others is extremely slow, so I figured i'd make the base site out of php, then use javascript for clientside.

My python bot basically saves the output into a json. I could make a PHP bot but essentially it would be the same thing.

I know how to change the value of the input, but i've tried putting it into a function and getting json to call it repeatedly. It doesnt work. Maybe i'm missing something? Would you like me to make a jsfiddle?

looking for a signature campaign, dm me for that
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 16, 2016, 03:07:01 AM
 #15

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.

Holy smokes! Python, PHP and NodeJS? There really is no reason to have 3 different server-side languages running at once. If you want one of your features to be "faster than preev" you'll need to cut down on the bloat. For example your node_modules directory is full of modules you aren't using.

What are you most experienced in? I'm guessing PHP based on the current source... My suggestion is you pick one server-side language and go with that, don't jump back and forth.

You can create one file that grabs all the necessary prices every N seconds and then stores them in a database. Then when doing the calculations for the users just pull from the database. You'll have the speed you want, and you won't have to worry about exceeding API request limits with the exchanges you are hitting.

Quote
I know the js to get the price to auto-update into a div, however for me it refuses it auto-update in the input box

For updating a div you typically do something like:

Code:
var myTarget = document.getElementById("myDiv");
myTarget.innerHTML = "My Text";

For updating an input box you need to change it from innerhtml to value.

Code:
var myTarget = document.getElementById("myInputBox");
myInputBox.value = "My Text";


I figured as much. I was told by a friend that PHP when compared to others is extremely slow, so I figured i'd make the base site out of php, then use javascript for clientside.

My python bot basically saves the output into a json. I could make a PHP bot but essentially it would be the same thing.

I know how to change the value of the input, but i've tried putting it into a function and getting json to call it repeatedly. It doesnt work. Maybe i'm missing something? Would you like me to make a jsfiddle?

Yea if you can put it in a JSfiddle I can help you get it working.

Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 16, 2016, 06:20:25 AM
 #16

Added source to OP. Please feel free to make a pull request! What I really need most is help with JavaScript!

(If you have any ideas at all, please suggest! Don't care if they're bad!)
Bro,literally you've too much of dependencies for a app as simple as this.Correct me if I'm wrong but what are the node modules for ? Perhaps the python lib for the price ticker that is
Code:
         response = urllib2.urlopen('https://api.cryptonator.com/api/ticker/btc-usd') 
is more than enough,no ? I'd suggest you we start from scratch again.Are you connected with the account SirLagsAlot anyway ? Nevermind your gh,says that.

Holy smokes! Python, PHP and NodeJS? There really is no reason to have 3 different server-side languages running at once. If you want one of your features to be "faster than preev" you'll need to cut down on the bloat. For example your node_modules directory is full of modules you aren't using.

What are you most experienced in? I'm guessing PHP based on the current source... My suggestion is you pick one server-side language and go with that, don't jump back and forth.

You can create one file that grabs all the necessary prices every N seconds and then stores them in a database. Then when doing the calculations for the users just pull from the database. You'll have the speed you want, and you won't have to worry about exceeding API request limits with the exchanges you are hitting.

Quote
I know the js to get the price to auto-update into a div, however for me it refuses it auto-update in the input box

For updating a div you typically do something like:

Code:
var myTarget = document.getElementById("myDiv");
myTarget.innerHTML = "My Text";

For updating an input box you need to change it from innerhtml to value.

Code:
var myTarget = document.getElementById("myInputBox");
myInputBox.value = "My Text";


I figured as much. I was told by a friend that PHP when compared to others is extremely slow, so I figured i'd make the base site out of php, then use javascript for clientside.

My python bot basically saves the output into a json. I could make a PHP bot but essentially it would be the same thing.

I know how to change the value of the input, but i've tried putting it into a function and getting json to call it repeatedly. It doesnt work. Maybe i'm missing something? Would you like me to make a jsfiddle?

Yea if you can put it in a JSfiddle I can help you get it working.

Here's a jsfiddle I put together. The best way to do this is to get the value to keep updating from a page, right?

http://jsfiddle.net/T7cZU/121/

looking for a signature campaign, dm me for that
MartinL
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
October 16, 2016, 06:29:34 AM
 #17

Here's a jsfiddle I put together. The best way to do this is to get the value to keep updating from a page, right?

http://jsfiddle.net/T7cZU/121/

There are two errors in that example. See a corrected version here. In general periodically polling for price updates is fine, but every 1.5 seconds is likely too frequent and might get you throttled.

What purpose does the back end fulfill? It seems you could forgo that and do everything you want to do on the client.
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 16, 2016, 06:32:03 AM
 #18

Here's a jsfiddle I put together. The best way to do this is to get the value to keep updating from a page, right?

http://jsfiddle.net/T7cZU/121/

There are two errors in that example. See a corrected version here. In general periodically polling for price updates is fine, but every 1.5 seconds is likely too frequent and might get you throttled.

What purpose does the back end fulfill? It seems you could forgo that and do everything you want to do on the client.

Speed. The back end retrieves the exchange rates, crops of the unnecessary information, while the frontend simply gets it from the server and multiplies it by the amount.

I've already moved onto the live site, almost done with the live updating.

looking for a signature campaign, dm me for that
MartinL
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
October 16, 2016, 06:35:33 AM
 #19

Speed. The back end retrieves the exchange rates, crops of the unnecessary information, while the frontend simply gets it from the server and multiplies it by the amount.

Those are relatively inexpensive operations. Letting the client handle them would not lead to any noticeable performance losses.

It does significantly simplify your project and allow you to easily host it for free, however.
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 16, 2016, 07:07:33 AM
Last edit: October 16, 2016, 07:19:01 AM by Decoded
 #20

Speed. The back end retrieves the exchange rates, crops of the unnecessary information, while the frontend simply gets it from the server and multiplies it by the amount.

Those are relatively inexpensive operations. Letting the client handle them would not lead to any noticeable performance losses.

It does significantly simplify your project and allow you to easily host it for free, however.

You make a compelling case. Another reason is that i'm much much more familiar with PHP than JavaScript. In fact, everything I know about it I just crammed in three hours.

I've made a push to github. After some testing, I can see that it's successfully querying the /api/btc/usd.php page, however the output shows NaN.

After further testing, it seems that what the js is returning from the page is [object Object]... working on this now.

Er... i've got it working for now, however it's still primitive, it get's the value after every keypress.

looking for a signature campaign, dm me for that
MartinL
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
October 16, 2016, 09:50:02 AM
 #21

A few more general observations: Checking dependencies into version control is unnecessary outside of a few exceptions and even considered bad practice. With Node.js, dependencies are often platform-specific, so they may not even be functional on architectures besides your own. Instead, specify your Node.js dependencies in a package.json file. Analogous tools exist for other languages and platforms.

The same goes for files such as logs, stack traces, configuration files and databases. These files are only meaningful in a narrow context, e.g. in a bug report, and therefore should not be checked in. You can use a .gitignore file to prevent these files from being shown in git and being accidentally committed.
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
October 16, 2016, 03:27:04 PM
 #22

Er... i've got it working for now, however it's still primitive, it get's the value after every keypress.

Looks to be working for the BTC/USD. Only one direction, it doesn't reverse if the user enters in a USD amount.

Here's a very simple version that just uses javascript for everything and runs on the client side.
https://jsfiddle.net/yb4ot795/
Seems pretty fast without having to cache or store anything in a database. 

Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 19, 2016, 12:01:04 AM
 #23

Er... i've got it working for now, however it's still primitive, it get's the value after every keypress.

Looks to be working for the BTC/USD. Only one direction, it doesn't reverse if the user enters in a USD amount.

Here's a very simple version that just uses javascript for everything and runs on the client side.
https://jsfiddle.net/yb4ot795/
Seems pretty fast without having to cache or store anything in a database.  

I've updated github. Will push to my VPS. At the moment, i've done alot on my c9.io test site. Will update when bitprice.link is updated.

I also have acquired bitprice.info, so that's a plus too!

EDIT - Site is live. First page load may take about one second to get the prices, then after that the prices are cached until you refresh the page. Currently only works on USD, and will get it to auto-refresh prices.

looking for a signature campaign, dm me for that
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 19, 2016, 11:38:33 PM
 #24

Could I get some help? I can't seem to understand what is wrong. Loaded straight from github, when I change the currency, I have to click it EUR three times before it changes the value. Same with changing back to USD.

Live test - bitprice.herokuapp.com

looking for a signature campaign, dm me for that
arunka71
Sr. Member
****
Offline Offline

Activity: 410
Merit: 257


View Profile
October 20, 2016, 04:14:32 PM
 #25

Why not use a a href for the menu items?
Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
October 31, 2016, 08:58:47 AM
 #26

Why not use a a href for the menu items?


I was going to get onto that, but I'm currently using a Semantic UI, which uses mainly divs.

Currently have yearlies, once they're over I'll start working on this again.

looking for a signature campaign, dm me for that
epson121
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
October 31, 2016, 04:08:45 PM
 #27

Hey @Decoded,

it seems like semantic-UI has something to do with this. Most likely it's UI is updated after your getprices() function is called. In addition, the reload() function in update.js is not triggerred in intervals, making it unusable. The fastest I could do to try and fix this can be seen in this commit: commit

I'm not sure if the code is intended to be run like this, and I would advise to remove the interval altogether, and at least use something native to semantic UI - check here. Also, cleanup would come in very handy. There is a lot of unneeded code there, and a mix of a lot of technologies (php, sh, py, js, whole node_modules etc). I had to go through a lot of files to make sure it's safe to run it.



Decoded (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1029


give me your cryptos


View Profile
November 01, 2016, 07:44:22 PM
 #28

Hey @Decoded,

it seems like semantic-UI has something to do with this. Most likely it's UI is updated after your getprices() function is called. In addition, the reload() function in update.js is not triggerred in intervals, making it unusable. The fastest I could do to try and fix this can be seen in this commit: commit

I'm not sure if the code is intended to be run like this, and I would advise to remove the interval altogether, and at least use something native to semantic UI - check here. Also, cleanup would come in very handy. There is a lot of unneeded code there, and a mix of a lot of technologies (php, sh, py, js, whole node_modules etc). I had to go through a lot of files to make sure it's safe to run it.
Bingo. I haven't made the push to GitHub yet, but I'm working on an entirely new drop down, without Semantic UI. What I found was that there was a lag after you clicked the button and until the div actually changed its contents.

looking for a signature campaign, dm me for that
Pages: 1 2 [All]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!