All Projects → mattevans → Dinero

mattevans / Dinero

Licence: mit
📈 💰 A golang interface for the Open Exchange Rates API

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Dinero

python-forex-quotes
Library to fetch and parse realtime Forex quotes and convert currencies
Stars: ✭ 25 (-63.24%)
Mutual labels:  currency, forex
javascript-forex-quotes
JavaScript Library for fetching realtime forex quotes.
Stars: ✭ 38 (-44.12%)
Mutual labels:  currency, forex
Php Forex Quotes
PHP Library for fetching realtime forex quotes.
Stars: ✭ 61 (-10.29%)
Mutual labels:  currency, forex
currency-api
Free Currency Exchange Rates API with 150+ Currencies & No Rate Limits
Stars: ✭ 507 (+645.59%)
Mutual labels:  currency, forex
React Currency Formatter
💵 react component for currency formatting
Stars: ✭ 38 (-44.12%)
Mutual labels:  currency
Go Money
Go implementation of Fowler's Money pattern
Stars: ✭ 887 (+1204.41%)
Mutual labels:  currency
Country Json
A simple data of the world by country each in JSON format.
Stars: ✭ 688 (+911.76%)
Mutual labels:  currency
Java Concurrency Progamming Tutorial
BAT华为大厂一线工程师四年磨一剑精心编排 Java 高并发编程案例代码 & 教程 & 面试题集锦。详细文档讲解请阅读本人的知识库仓:https://github.com/Wasabi1234/Java-Interview-Tutorial
Stars: ✭ 606 (+791.18%)
Mutual labels:  currency
Backtesting.py
🔎 📈 🐍 💰 Backtest trading strategies in Python.
Stars: ✭ 1,124 (+1552.94%)
Mutual labels:  forex
Coinonline
A Cryptocurrency/Blockchain wallet app based on React Native
Stars: ✭ 59 (-13.24%)
Mutual labels:  currency
Td Ameritrade Client
TD Ameritrade Java Client
Stars: ✭ 35 (-48.53%)
Mutual labels:  forex
Gocurrency
Simple currency converter. Insert an amount, what currency to convert from and what currency to convert to.
Stars: ✭ 26 (-61.76%)
Mutual labels:  currency
Laravel Cconverter
A simple currency converter plugin for Laravel 5. Currency providers: The European Central Bank, OpenExchange, CurrencyLayer and fixer.io
Stars: ✭ 39 (-42.65%)
Mutual labels:  currency
Money
A precise, type-safe representation of a monetary amount in a given currency
Stars: ✭ 817 (+1101.47%)
Mutual labels:  currency
Digital Currency
Create your own Digital Currency with this self-hosted Web App. Check out the Demo website
Stars: ✭ 30 (-55.88%)
Mutual labels:  currency
Gym Anytrading
The most simple, flexible, and comprehensive OpenAI Gym trading environment (Approved by OpenAI Gym)
Stars: ✭ 627 (+822.06%)
Mutual labels:  forex
Straks
A new decentralised, open source, community driven digital currency, focusing on e-commerce utility
Stars: ✭ 53 (-22.06%)
Mutual labels:  currency
Ta4j
A Java library for technical analysis.
Stars: ✭ 948 (+1294.12%)
Mutual labels:  forex
Currencyviewer
Short python framework that dynamically displays and converts the cryptocurrencies in your Kraken wallet into equivalents fiat money.
Stars: ✭ 13 (-80.88%)
Mutual labels:  currency
Exchange Rates
💱 Querying a rate-limited currency exchange API using Redis as a cache
Stars: ✭ 37 (-45.59%)
Mutual labels:  forex

dinero

GoDoc Build Status Go Report Card license

dinero is a Go client library for accessing the Open Exchange Rates API (https://docs.openexchangerates.org/docs/).

Any forex rates requested will be cached (in-memory), keyed by base currency. With a customisable expiry window, subsequent requests will use cached data or fetch fresh data accordingly.

Installation

go get -u github.com/mattevans/dinero

Usage

Intialize

// Init dinero client passing....
// - your OXR app ID
// - base currency code for conversions to work from
// - your preferrerd cache expiry
client := NewClient(
  os.Getenv("OPEN_EXCHANGE_APP_ID"), 
  "AUD",
  20*time.Minute,
)

Currencies

List

// List all currencies available.
rsp, err := client.Currencies.List()
if err != nil {
  return err
}
[
  {
    "code": "INR",
    "name": "Indian Rupee"
  },
  {
    "code": "PYG",
    "name": "Paraguayan Guarani"
  },
  {
      "code": "AED",
      "name": "United Arab Emirates Dirham"
  },
  ...
}

Rates

List

// List latest forex rates. This will use AUD (defined 
// when intializing the client) as the base.
rsp, err := client.Rates.List()
if err != nil {
  return err
}
{
   "rates":{
      "AED": 2.702388,
      "AFN": 48.893275,
      "ALL": 95.142814,
      "AMD": 356.88691,
      ...
   },
   "base": "AUD"
}

Get

// Get latest forex rate for NZD. This will use AUD (defined 
// when intializing the client) as the base.
rsp, err := client.Rates.Get("NZD")
if err != nil {
  return err
}
1.045545

Change Base Currency

You set a base currency when you the intialize dinero client. Should you wish to change this at anytime, you can call...

client.Rates.SetBaseCurrency("USD")

Expire

You set your preferred cache expiry interval when you intialize the dinero client. By default, cached rates will expire themselves based on your configured interval.

You can force an expiry of the rates for your currency set by calling...

client.Cache.Expire()

Contributing

If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].