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 - TapSwap on Solana Airdrops In 2024

origin »

Bitcoin (BTC) на Currencies.ru

$ 62572.73 (-0.07%)
Объем 24H $26.425b
Изменеия 24h: 0.99 %, 7d: 0.35 %
Cегодня L: $61392.69 - H: $62804.76
Капитализация $1232.656b Rank 1
Цена в час новости $ 6401.89 (877.41%)

price bitcoin genserver def start data let

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


Фото:

Bitcoin To $240,000: Analyst Cites Key Narrative As Catalyst

Bitcoin price has fallen by over 10% after briefly touching its all-time high of $69,000, propelled by investors’ flood of money into BTC Spot Exchange-Traded Funds (ETFs). However, intense volatility surrounding the crypto asset’s price has triggered a rebound to the $68,000 mark, which highlights the return of positive enthusiasm, prompting predictions of a significant rally to an unprecedented height.

2024-3-9 19:00


Bitcoin approaches its $69k all-time high price: Should you start buying BTC-related projects?

Key takeaways BTC continues to trade around $62k as it closes in on its all-time high price. Bitcoin Dogs’ presale will end in 12 days and has already raised over $6.3 million Bitcoin eyes its all-time high price of $69k The crypto market was bullish this week, adding 20% to its value in the last […] The post Bitcoin approaches its $69k all-time high price: Should you start buying BTC-related projects? appeared first on CoinJournal.

2024-3-3 00:16