Forum Home
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    Animated FTC price indicator

    Technical Development
    7
    20
    7715
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      uncle_muddy administrators last edited by

      I’ve only done this in Python, as thats all I know (and I don’t know much about that)

      I use a requests.get call to the API to return the value I’m looking for in this case it’s the current value of 1 FTC to enable the conversion between pounds later in the program, I also do it using payloads as that works out for me better as I’m doing a couple more calls into the API later as the transaction moves on so can just substitute the “payload” data

      import requests
          
          #returns current feathercoin value
      def toFTC(v,c='gbp',j='0'):
          payload = {'output': c, 'amount': v, 'json': j}
          to_ftc_url = 'http://api.feathercoin.com/'
          ftotal=-1
          try:
              r = requests.get(to_ftc_url, params=payload)
              print(r.url)
              if r.status_code == 200:
                  ftotal = round(float(r.text) ,6)
          except:
              pass
          return ftotal
      
      print toFTC(1)
      

      If you run the above the output printed to the screen is the current FTC value in GBP, rounded to 6 decimal places. If you wanted to do it the other war around i.e. how many FTC to the FIAT the api call needs to look something like this

      http://api.feathercoin.com/?output=ftcgbp&amount=1&json=1
      

      where you can specify the FIAT currency as follows

      ?output=ftcaud (Australia) 
      ?output=ftceur (Euro)
      ?output=ftcgbp (Great Britian)
      ?output=ftcnzd (New Zealand)
      ?output=ftcusd (United States)
      

      Hope this gives you a pointer in the right direction

      1 Reply Last reply Reply Quote 0
      • V
        voingiappone Regular Member last edited by

        uncle_muddy, that’s interesting! It looks like you’re doing the very same thing I tried in JS but using Python… I didn’t have time to try it but being you the author I guess it works… ;) so, why is JS not able to do the same thing?

        Well, I could use Python and forget about JS but the only problem is that to use it, the proper Firebase module have to be installed on the server. This would be totally fine if it wasn’t for the fact I would like to have a small script to be easily embeddable in blogs, CMSs etc… the original purpose could easily get lost if the end user has to install stuff on the server…

        I will have to dig the Firebase documentation more… or to try harder on the JS side.

        Thx for the nice script though!

        1 Reply Last reply Reply Quote 0
        • V
          voingiappone Regular Member last edited by

          I’m looking at this project since you posted it, and keep having the urge to fine tune that css and graphics of yours, but never get enough time lately…maybe over the weekend…maybe…

          Dude, you’re more than welcome! Feel free to fiddle with the code.

          I think I’m going to be a little bit less busy starting from next week Friday… If it helps I can set up a GIT repo so we can collaborate!

          It’s nice to see somebody eager to jump on board this dull “project” :D

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User last edited by

            I think the project is worth finishing ahy.

            It’s a lovely little ticker and I think it would be great to have for anyone to chuck into their site etc.

            1 Reply Last reply Reply Quote 0
            • V
              voingiappone Regular Member last edited by

              Here it is:
              210c6r9.jpg

              Woa, man that’s slick! It’s a properly formatted css… however this is not rendered well in midori too… well, nobody will care I think.

              Now, I will break free from my obliges this week so I will try to do a proper git project and share the info with those who want to participate. I will also try to fix the js / python thing.
              As Calem said, it would be nice to have a small copy-pasteable widget to be put on websites! And if the trincket would be able to auto-update firebase data it would be awesome!

              Thank you so much for the contribution!

              1 Reply Last reply Reply Quote 0
              • ?
                A Former User last edited by

                That would be cool to also have as a widget on my phone.

                1 Reply Last reply Reply Quote 0
                • kris_davison
                  kris_davison last edited by

                  I use the Litecoin Widget on android which is really good and can show BTC FTC LTC PXC and lots more in your local currency. :)

                  1 Reply Last reply Reply Quote 0
                  • V
                    voingiappone Regular Member last edited by

                    That would be cool to also have as a widget on my phone.

                    Calem, that could be the next step. I don’t have any idea of how to code for mobile apps but once the firebase is there, it will be easy for those with minimum skills!

                    As you may have noticed I’m stalled now: I have to write a PhD thesis in one month… and I have just been notified of the deadline. I’m freaking out, so I had to park this. Will get back on it as soon as I can.

                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User last edited by

                      Thats ok, good luck with your thesis!

                      1 Reply Last reply Reply Quote 0
                      • T
                        tmuir12 Regular Member last edited by

                        I’ve only done this in Python, as thats all I know (and I don’t know much about that)

                        I use a requests.get call to the API to return the value I’m looking for in this case it’s the current value of 1 FTC to enable the conversion between pounds later in the program, I also do it using payloads as that works out for me better as I’m doing a couple more calls into the API later as the transaction moves on so can just substitute the “payload” data

                        import requests
                            
                            #returns current feathercoin value
                        def toFTC(v,c='gbp',j='0'):
                            payload = {'output': c, 'amount': v, 'json': j}
                            to_ftc_url = 'http://api.feathercoin.com/'
                            ftotal=-1
                            try:
                                r = requests.get(to_ftc_url, params=payload)
                                print(r.url)
                                if r.status_code == 200:
                                    ftotal = round(float(r.text) ,6)
                            except:
                                pass
                            return ftotal
                        
                        print toFTC(1)
                        

                        If you run the above the output printed to the screen is the current FTC value in GBP, rounded to 6 decimal places. If you wanted to do it the other war around i.e. how many FTC to the FIAT the api call needs to look something like this

                        http://api.feathercoin.com/?output=ftcgbp&amount=1&json=1
                        

                        where you can specify the FIAT currency as follows

                        ?output=ftcaud (Australia) 
                        ?output=ftceur (Euro)
                        ?output=ftcgbp (Great Britian)
                        ?output=ftcnzd (New Zealand)
                        ?output=ftcusd (United States)
                        

                        Hope this gives you a pointer in the right direction

                        Thank you very much for this.

                        I’ve been struggling to do just this all night (I am a cut and paste coder) and only barely know how to install a library on Python let alone do any useful coding

                        As I still have a spare Raspberry Pi and several Arduinos lying around and was thinking of making an ‘old school’ analogue meter display showing current price of FTC and high and low prices over the last week.

                        Something similar to this

                        http://makezine.com/projects/data-dial-dashboard/

                        No real value in the project other than its something to do.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post