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.

origin »

Bitcoin (BTC) на Currencies.ru

$ 89561.85 (+0.20%)
Объем 24H $59.488b
Изменеия 24h: -1.90 %, 7d: -1.14 %
Cегодня L: $89035.17 - H: $89763.64
Капитализация $1787.377b Rank 1
Цена в час новости $ 6401.89 (1298.99%)

price bitcoin genserver def start data let

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


Bitcoin ‘True Bull Run’ May Yet To Begin — Analyst Explains Why

The Bitcoin price action has been somewhat impressive in 2025, as the flagship cryptocurrency ascended from around $93,300 in early January to its current all-time-high price of $126,000 this month. While the digital asset saw a couple of resets along the way, it continued to put in new highs, reflecting the magnitude of confidence held by its long-term investors.

2025-10-26 19:30


Фото:

Bitcoin Briefly Dips Below $100,000 – Experts Share Shocking Price Predictions

Bitcoin (BTC) price hit $99,000 over the weekend, catching most traders unawares. The drop saw the price fall as global tensions rose following U. S. airstrikes against Iranian nuclear sites. With the crypto market panicking with fear, most of the investors questioned whether this was the ‘beginning of the end’ for a bigger correction.

2025-6-23 17:00


Bitcoin Set for “Mega Expansion” as Chart Signals Parabolic Price Spike

According to CryptoCon, Bitcoin is setting up for what he calls a “mega expansion” phase, one that could lead to faster and more dramatic price increases heading into the end of 2025. After carefully mapping out BTC price action throughout Cycle 4, CryptoCon suggests that most of this cycle has been about slow, sideways movement, […] The post Bitcoin Set for “Mega Expansion” as Chart Signals Parabolic Price Spike appeared first on CaptainAltcoin.

2025-5-14 23:00