Using Elixir to Track The Price of Bitcoin

Using Elixir to Track The Price of Bitcoin
фото показано с : bitcoints.com

2018-7-10 19:38

Since our project will be fetching the price of a Bitcoin, we need a place to fetch Bitcoin data.
Finally let’s get the price with Map.get, now that we have the price let’s print what the price was.
lib/teacher/coin_data_worker.ex

defmodule Teacher.CoinDataWorker do
use GenServer

def start_link(args) do
GenServer.start_link(__MODULE__, args, name: __MODULE__)
end

def init(state) do
schedule_coin_fetch()
{:ok, state}
end

def handle_info(:coin_fetch, state) do
price = coin_price()
IO.inspect(“Current Bitcoin price is $#{price}”)
schedule_coin_fetch()
{:noreply, Map.put(state, :btc, price)}
end

defp coin_price do
“http://coincap.io/page/BTC”
|> HTTPoison.get!
$ iex -S mix
“Current Bitcoin price is $6149.728”
“Current Bitcoin price is $6149.728”
“Current Bitcoin price is $6149.728”
“Current Bitcoin price is $6149.728”
> :observer.start()
This is great – we’re fetching data from the API, parsing it, and logging the price.
$ iex -S mix
> “Current Litecoin price is $81.0156”
“Current Ethereum price is $454.076”
“Current Bitcoin price is $6148.09”
> :observer.start()
And let’s start the observer.

Similar to Notcoin - Blum - Airdrops In 2024

origin »

Bitcoin (BTC) на Currencies.ru

$ 95742.75 (-1.47%)
Объем 24H $40.289b
Изменеия 24h: -1.76 %, 7d: -6.90 %
Cегодня L: $95742.75 - H: $97458.26
Капитализация $1895.671b Rank 1
Цена в час новости $ 6401.89 (1395.54%)

price bitcoin genserver def start data let

price bitcoin → Результатов: 126


Фото:

Bitcoin Price To See 70%+ Powerful Bull Wave To Push It Over $100,000, How High Can It Go?

The Bitcoin price is slowly breaching the $70,000 mark, showcasing steady upward momentum despite downward pressure from the bearish performance of the US equities market. Taking note of Bitcoin’s recent price movements, a crypto analyst has suggested that the pioneer cryptocurrency could be gearing up for a strong bull wave that could drive its price by over 70%, pushing it past the $100,000 milestone.

2024-10-26 04:00