Drupal8 Currency Module, How to configure in my content type and views? - currency

I installed the Currency module in my localhost, i really in need of the currency converter dynamically.
I store the currency value in USD on my field and shown as its in my view of table format.
For Customer, view of currency drop-down will be there, if the user selects the currency the value it need to be convert from USD to AUD, AUD to NZD etc., like this.
Kindly Provide me solution whether the currency converter gets the latest exchange rate and currency value.
Need for support

If you use Coorrency - Currency Converter module ,then this is the stratergy
if you use a free service then the rates are refreshed every 30
minutes.
if you use a Premium service then the rates are refreshed every 15 minutes.

Related

Sample call to Interactive Brokers for a currency pair?

I'm attempting to run Interactive Broker's included code sample.
http://www.interactivebrokers.com/download/JavaAPIGettingStarted.pdf
On about page 42 it details how to pull market data feeds. My question is, has anyone successfully put in the parameters needed to pull currency pair data??
public synchronized void reqMktData(int tickerId, Contract contract, String genericTickList, boolean snapshot)
I cannot find the valid inputs that will correct the errors I'm seeing from the client.
Parameters needed
List of values inside Contract class are here : https://www.interactivebrokers.com/en/software/api/apiguide/java/contract.htm
STK == "stock" , should this be set to CASH for Forex data?
IDEALPRO == the exchange according to this page : http://ibkb.interactivebrokers.com/tag/fx-trader
USD.JPY = SYMBOL (this here is a guess on my part)
USD == "underlying currency" , here I am guessing again.. seems the currency needs to match the transaction currency.
the pair in the format Transaction Currency.Settlement Currency (example: EUR.USD). The Underlying column will display only the Transaction Currency.
After scouring IB's forum I have found something that works for FX data feeds. You need to put the TransactionCurrency as the Symbol, and the SettlementCurrency as the underlying in the dialog box.
Here is the resulting data feed
As I can remember, I used: CASH, IDEALPRO, EUR.USD, USD
You can see all parameters example in the TradeStation client. Just find the needed instrument and look at it's properties.
And remember that not all parameters must be necessarily filled
At the worst, show the error.

get rate with Ruby Money gem

I'm using the Ruby Money gem (For rails) for my app and i want to save the used currency rate for every order.
My base currency is USD and i give my users the option to pay in EUR, on a order save i want to record the used currency conversion rate.
I just can't find a method to get the used rate from this lib, anybody knows how to do this?
I'm also looking for best practice on this, for now i'm planning on saving the prices in order_lines in the users currency and save the used currency per line. As my original prices are in dollars i'm also saving the price in dollar per order line as reference.
Thanks in advance!
For this example bank:
# config/initializers/money.rb
dev_bank = Money::Bank::VariableExchange.new
dev_bank.add_rate("EUR", "USD", 1.35)
dev_bank.add_rate("USD", "EUR", 1/1.35)
Money.default_bank = dev_bank
you can do this:
# somewhere else in your code
Money.default_bank.get_rate('EUR', 'USD')
See more info in the documentation
It looks like you're supposed to set up exchange rates in your configuration code using the exchange bank object or the money.rb initializer, in which case you already have access to the exchange rate in your code.
If for some reason you have access only to the input and output of the exchange conversion, you should be able to calculate the exchange rate yourself.

ios Load a tab separated text to Dictionary and UIPickerView

I am trying to implement a UiPickerView which will show the currency name and its symbol.
For example: United Stated of America, Dollars $
I have an entire list of 406 currency names containing the currency identifier, currency name and symbol which is tab seperated:
USD United Stated of America, Dollars $
VND Vietnam, Dong ₫
I don't want to show the identifier to the user, just the name and symbol. I plan to use the identifier for use in the code.
My questions are
What is the best way to store all the 406 currencies within the app. Is using the AppName-Prefix.pch useful for this? Or should I use a plist?
How should I load all these currencies in a dictionary with the identifier as the key?
I don't think loading each and every identifier using code will be an efficient way?
Instead of using this way of showing all currencies to the user, is there any better way from the Apple or 3rd party API which provides us a list of all the currencies in circulation?
Just showing all the currency options to the user to select one seems like too much work...
Apple should include another Picker view just like they have for Date Picker which is just for currencies.
One way to go about this is using CoreData.
Save all of them in Data Base,with the currencyList as entity and currencyName, Country, Currency ID as Attributes. perform a fetch request when user performs a query. Display just the required currency details

Database, Currency Modeling, Localization strategies

What's the best strategy for storing e-commerce product information (i.e. product price, current price) in a localized-currency environment?
I came across an issue in Spree, an e-commerce engine for Ruby on Rails regarding the display of currency using localization, delimiters, precision digits, etc.
However, resolving the display of price became more complex, when we had to figure out if the storing of values in the database should include the localization delimiter / precision digits or be normalized. The solution involves localizing both the display of the value as well as potentially normalizing the stored value in the database. But I'm not sure if that's the standard practice (scrubbing the data to fit a "standard" precision and delimiter OR modifying the model to take in a "currency" field, and keeping the input standard.
CASE STUDY:
If a product from the USA (using "en" localization file) is priced at 2.99, then it is stored in the database as 2.99.
If the site updates to be localized for Germany (using "de" localization file), then it is priced at 2,99.
But should updates to that price (and cost_price) value be stored as 2.99, or 2,99? If they're stored at 2.99 and the value is returned back to the view from the model, then the localization will modify the value to be 2,99.
I'm hesitant to standardize user input without their knowledge. Is standardizing currency values normal, or should the model change to handle multi-currency formats?
An extra issue to note is that even though the Spree engine can change localization, I don't believe it can flip by user-demand yet. So it's not technically a "multi-currency" environment, I believe? I'd like to pick a choice that can scale.
RELATED QUESTIONS:
database design: accounts with multi currency
Currency modeling in database
The issue is that you have a product, selling in different exchange-regimes with different cultures. Say it's $1,450.00 USD in America, and €1111,11 in Germany. There are two main factors:
A. There are different prices in different currencies
B. There are different ways to display a money amount in different cultures
Regarding A, you could
store in one price/currency, and adjust to different exchange rates on the fly
or adjust nightly
or just have different prices in different countries
I would go with a table of prices, segregated by currency. updating nightly is probably reasonable:
ProductId Currency Price
1 EUR 1111.11
1 CAD 1436.65
1 USD 1450.00
These values should be numbers, so that you can easily do math on them if necessary. Use decimal(10,2) in your database
Regarding B
You should format the selected price to a given culture upon display. Imagine an American paying in Euros. What do they want to see? Your output would look like this, depending on the selected culture:
Say it's 1,111.11 Euros
Culture Price Long Name
de_de 1.111,11 (German)
fr_ca 1 111,11 (Quebec)
en_us 1,111.11 (US English)
It's all the same amount, just formatted differently, depending on the user's preferences.
If users are entering in different amounts, you will also have to parse their values based on the selected culture. Check out Yii's (sorry, PHP) L10N and I18N features.
Notes:
Whatever you do, don't store it as a float, or you will get subtle errors over time. Use the decimal type
Consider using 4 digits after the decimal place for fields that are the result of calculations

Store Currency code along with price

I am storing a price in my database.
I figured I should store the currency as my application with need to support internationalisation.
I believe the correct way is to store the ISO 4217 currency code, such as USD for US$, AUD for AU$ and EUR for Euros ...
I have a price and a currency attribute in model... Am I doing it right?
How do convert the currency code to it Symbol version? is there a helper for this? do I need to create myself a corresponding hash?
Cheers,
Joel
You should have a look at the Money gem. Handles currency codes and has support for exchange rates and formatting.
https://github.com/RubyMoney/money

Resources