Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8630331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:02:16+00:00 2026-06-12T09:02:16+00:00

I am currently learning how to use the IBrokers package. I can pull equity

  • 0

I am currently learning how to use the IBrokers package.

I can pull equity prices at frequencies I want, and option prices, but I’m currently stuck on pulling foreign exchange rates.

I don’t know how to set up the right twsContract, for calling with reqHistoricalData.

I am interested in getting CADUSD currencies on say a 1 min basis. How can I do this?

The example in the manual gives:

currency <- twsCurrency("EUR")

When I try and call this with say reqHistoricalData(tws, currency) it comes back with an error saying something like “no historical data available 1D”. As I can’t even get the example in the manual to work, I’m rather stuck…

Can someone please enlighten me as to what the correct syntax is? If I have a couple of examples that actually work, I can take it from there.

Also, when I try using "USD.CAD" or "CAD.USD" as the ticker in the twsContract object, I’m getting complaints that this isn’t a valid security. How can I find out what the right ticker name for USD.CAD would be? Right now I figure out the ticket for stocks by looking at my interactive brokers application which is open at the same time obviously, and typing the company name and doing a search. The ticker generally comes back e.g. (type apple, get back AAPL when I want to add this security to my portfolio in the interactive brokers workstation).

Any help would be much appreciated.

Also, another related question is how can I pull the historical of say the S&P500 price index on a 1 min basis say?

I am guessing I would use a twsContract object in R, but I don’t know what parameters to use. What should the ticker be? The trade workstation mentions it’s an “index” product type (obviously), which doesn’t fit into any of the wrappers like twsStock, twsCurrency etc… Again, Is there an example of this somewhere, which actually works?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:02:18+00:00Added an answer on June 12, 2026 at 9:02 am

    You’re having trouble getting data for FX because you’re trying to get TRADES data which IBrokers does not disseminate for FX. Instead, you should use whatToShow="BID" or whatToShow="Ask". e.g.

    tws <- twsConnect()
    ccy <- reqContractDetails(tws, twsCurrency("USD", "CAD"))[[1]]$contract
    reqHistoricalData(tws, ccy, whatToShow='BID')
    

    Getting data for the S&P 500 index is similar

    reqHistoricalData(tws, reqContractDetails(tws, twsIndex("SPX", "CBOE", "USD"))[[1]]$contract)
    

    Your question is pretty broad and reads like a request for an overview of the package. Have you read the vignette? (vignette("IBrokers"))


    I have a package on R-Forge called twsInstrument that provides some wrappers to make things easier for you.

    library(twsInstrument)
    get_quote("USD.CAD")
    getBAT("USD.CAD") #gets the last 5 days of minutely Bid/Ask/Trade/Midpoint
    

    Also, see ?reqTBBOhistory and twsInstrument:::update.data to download lots of data to disk.

    Finally, I recommend asking these types of questions on the r-sig-finance mailing list where Jeff is likely to see it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently learning the zsh and now I wanted to use strftime but
I'm currently learning to use SymPy. It seems interesting and useful, but I haven't
I am currently learning to use the Propel ORM, and I want to reuse
Hi I am currently learning how to use service and notifications in android and
I'm currently learning on how to use the Python optparse module. I'm trying the
i am currently learning Zend Framework 1.10 and intend to use Doctrine 2. however
I'm currently learning to use MasterPages and ContentPlaceHolders in ASP.NET 3.5 and C# -
I am currently learning Java EE using JBoss and I am kind of stuck
As I'm currently learning to use WCF Services, I am constantly encountering tutorials on
Im very new to Objective-C and am currently learning how to use Xcode and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.