Displaying 20 results from an estimated 278 matches for "currency".
2011 Oct 12
1
scopes related question
Hello,
Have a question related scope definition. I need to define a scope
based on related model attribute values like this.
class Product < ActiveRecord::Base
belongs_to :currency
scope :with_currency, lambda { |currency|
unless currency.to_s.upcase == ''ALL''
# here I need to define a scope that would test for currency.char_code
to match a passed value
# something like.. This is where I need help
where("currency.char_code = ?", currency...
2006 Jun 18
13
Currency calculation
I''m thinking of experimenting with some currency conversion. However,
I''d like the conversions to be in synch with the current rates.
Anyone know (and this maybe out in left field) if there is some online
(perhaps xml) or other data stream I can connect with in my code to
output values based on user selection ?
TIA
Stuart
2006 Mar 25
4
Rails PayPal and Currencies other than USD
Has anyone been able to make direct API calls to PayPal in currencies
other than USD? I get an error message "The currency code submitted is
not supported. Check the currency code and try again."
I''m using the PayPal plugin for Rails. I can successfully transact in
USD, but not AUD (Australian Dollars).
Cheers,
Dan
2013 Apr 03
4
Better way of writing R code
Dear R forum,
(Pl note this is not a finance problem)
I have two data.frames as
currency_df = data.frame(current_date = c("3/4/2013", "3/4/2013", "3/4/2013", "3/4/2013"), issue_date = c("27/11/2012", "9/12/2012", "14/01/2013", "28/02/2013"), maturity_date = c("27/04/2013", "3/5/2013", &q...
2011 Jan 07
1
Calculating Returns : (Extremely sorry for earlier incomplete mail)
...e mail through my cell, only to realize today about the way mail has been transmitted. I am again sending my complete mail through regular channel and sincerely apologize for the inconvenience caused.
## Here is my actual mail
Dear R forum helpers,
I have following data
trans <- data.frame(currency = c("EURO", "USD", "USD", "GBP", "USD", "AUD"), position_amt = c(10000, 25000, 20000, 15000, 22000, 30000))
date <- c("12/31/2010", "12/30/2010", "12/29/2010", "12/28/2010", "12/27/2010"...
2011 Apr 09
1
How do I make this faster?
I was on vacation the last week and wrote some code to run a 500-day
correlation between the Nasdaq tracking stock (QQQ) and 191 currency pairs
for 500 days. The initial run took 9 hours(!) and I'd like to make it
faster. So, I'm including my code below, in hopes that somebody will be able
to figure out how to make it faster, either through parallelisation, or by
making changes. I've marked the places where Rprof showed m...
2011 Jan 07
1
Currency return calculations
Dear sir, I am extremely sorry for messing up the logic
asking for help w.r.t. my earlier mails
I have tried to explain below what I am looking for.
I have a database (say, currency_rates) storing datewise
currency exchange rates with some base currency XYZ.
currency_rates <- data.frame(date =
c("12/31/2010", "12/30/2010", "12/29/2010",
"12/28/2010", "12/27/2010","12/24/2010", "12/23/2010",
"12/2...
2006 Feb 28
12
Examples for Money library ?
...;'m trying to setup a Model to use this library, but can''t seem to wrap my
head around how it is exactly supposed to work.
My Model (Foo) looks like:
===============
composed_of :commission, :class_name => "Money", :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in script/console, I''m unable to get the correct behaviour (at least I
think), from the library.
===============
>> t = Foo.new(:commission => 34)
NoMethodError: undefined method `cents'' for 34:Fixnum
from (eval):3:in `commission=''
I...
2013 Apr 25
1
Linear Interpolation : Missing rates
...", "EURO_2m", "EURO_2m", "EURO_2m"), rates = c(2.05, 2.07, 2.06, 2.06, 2.22, 2.24, 2.23, 2.23, 2.31, 2.33, 2.33, 2.31, 1.06, 1.08, 1.08, 1.08, 1.21, 1.21, 1.23, 1.21, 1.41, 1.39, 1.39, 1.37, 1.82, 1.82, 1.81, 1.80, 1.98, 1.98, 1.97, 1.97, 2.1, 2.09, 2.09, 2.11))
currency = c("EURO", "GBP", "USD")
tenor = c("1w", "2w", "1m", "2m", "3m")
# _________________________________________
> df
rate_name rates
rate_name rates
1 USD_1w 2.05
2 USD_1w 2.07
3 USD_1w 2.06
4 ...
2008 Jun 29
2
How to write test about validates_associated
Here is my model:
class Account < ActiveRecord::Base
has_many :users, :dependent => :destroy
has_many :bus
belongs_to :currency
has_many :mylogs, :dependent => :destroy
has_many :batchuserdefines, :dependent => :destroy
has_many :materialuserdefines, :dependent => :destroy
has_many :materials
has_many :inventories
has_many :batchs
has_many :courses
has_many :projects
has_many :initstocks,:dependen...
2013 Apr 16
3
Splitting the Elements of character vector
Dear R forum
I have a data.frame
df = data.frame(currency_type = c("EURO_o_n", "EURO_o_n", "EURO_1w", "EURO_1w", "USD_o_n", "USD_o_n", "USD_1w", "USD_1w"), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43))
currency_type rates
1 EURO_o_n 0.470
2 E...
2006 Mar 03
1
number_to_currency() helper == non DRY == could be improved
Hi all,
Apologies in advance if I got this one wrong, I''m still just a
newbie ;-)
Going through the Apple ADC RoR tutorial it suddenly occurred to me
that the ''number_to_currency()'' helper method was not DRY streamlined.
Scenario::
The "number_to_currency()" methods options hash works great when I
need to dynamically display different currencies when I call
"number_to_currency()", as long a I have an idea of what the currency
should be ea...
2011 Jan 07
0
Odp: Currency return calculations
...ctive solution you had offered. Sorry once again sir and will certainly try to be very careful in future.
Thanks again and have a great weekend sir.
Regards
Amelia
--- On Fri, 7/1/11, Petr PIKAL <petr.pikal@precheza.cz> wrote:
From: Petr PIKAL <petr.pikal@precheza.cz>
Subject: Odp: Currency return calculations
To: "Amelia Vettori" <amelia_vettori@yahoo.co.nz>
Cc: r-help@r-project.org
Received: Friday, 7 January, 2011, 12:59 PM
Hi
What is wrong with my suggestion
then.
> rate1
USD GBP EURO CHF AUD
1 112.05 171.52 42.71 41.50 109.55
2 112.90 168.2...
2009 Oct 14
3
currency conversion function?
Dear all
Is there any R function that would perform currency conversion using
up-to-date exchange rates? I would be looking for a function that
allows to download recent exchange rates (say, from Yahoo!) and then
use these in converting currencies (say, USD to EUR).
I am not sure whether r-sig-finance would be more appropriate, but the
(off-)topic feels gen...
2006 Sep 17
2
currency or stock trading strategy
Hi,
are there any good charting and analysis tools for use with
currencies, stocks, etc. in R? I have some tools to download currency
data from the NYFRB using python and XML. Can we get and parse an XML
download using R? Can we have interaction in R plots? Does anyone
use R for back-testing trading strategies? Are there any forums for
discussion of using R for this specific purpose (apart from this
general list)? Is anyone...
2006 Jan 17
2
money data types
What data type is best for storing currency? I''m trying to come up
with a reliable cross-database solution for rails that is not too
complicated. Since I''m going to have currency fields all over the
place, I''m not so sure that using two integer fields for each amount
would qualify as uncomplicated. I''d...
2006 May 08
2
Creating a "Foo has_many bars" association where bar isn''t a model.
Hi
Let''s say we have model Foo. Each Foo instance can have several bars.
Those bars are primitive, so they shouldn''t be models. For example,
Foo might be a type of convention, and the bars might be years the
convention was held in. Naively, we would have a conventions_years
date, and put:
has_many :years
inside class Convention. But then we''d get an error, since for
2010 Feb 24
2
How to read percentage and currency data?
I'm struggling to find any help on this seemingly simple question - how does
one read data with percentage (%) or currency (?,$ etc.) signs? When I try
to read a data file which has any of those symbols in the data fields, they
are read as characters rather than values. Is there a function or library
which can deal with such values?
As an example, I use this sample from one of chinna's questions:
Store Year Reven...
2012 Nov 21
3
Problems understanding use of regular expression (in gsub) for manipulating currency
Hello,
After reading help file, various threads on this board, and other online tutorials, I've attempted to use gsub (using Perl-like syntax) to change a currency string into something that can be converted to numeric type using only one regular expression. Can anybody point out my error? Note that
> x <- "\"$ 1,200,300,400.50\""
Tried the following in an attempt to arrive at "1200300400.50"
> gsub("(^[\\D...
2009 Sep 24
1
Downloading currency data from from Yahoo
Hi,
I wanted to download some currency data using "quantmod" package, however
got following error :
> getSymbols('USD/GBP',src='yahoo')
Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,
:
cannot open URL
'http://chart.yahoo.com/table.csv?s=USD/GBP&...