basic R question - Matlab, R project and Python | futures io social day trading
futures io futures trading

basic R question
Updated: Views / Replies:2,754 / 2
Created: by sam028 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

basic R question

  #1 (permalink)
Administrator: Retired Backtester
Rennes France
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
sam028's Avatar
Posts: 3,414 since Jun 2009
Thanks: 3,610 given, 4,071 received

basic R question

I'm new to R, and after having read some examples of R code here , I tried to play a bit with it.

The first step was to get some data. I'm using Interactive Brokers, and as everybody knows, the datafeed is not very good, and you can't easily get a lot of historical data, as their have limitations.
With these limitations, you can't backtest (with NT for example) a large amount of data if you don't already have these data...
Anyway, the idea was to get 1 year of US stocks data from IB, so I used IBrokers CRAN package. This smart package know IB limits, and manage them (some sleep between each request).

The R script looks like this:

my_func <- function (connContractnb=30barSize "1 min"file, ...) {
endDateTime <- Sys.Date() - seq(nb0, -5)
duration <- "5 D"
reqHistoricalData(connContractbarSize barSizeduration durationendDateTime endDateTi
contract <- twsEquity('A','SMART','ISLAND')
fh <- file('A.dat',open='a')
contract <- twsEquity('AA','SMART','ISLAND')
fh <- file('AA.dat',open='a')
I have something like 600 symbols, and had generated this script with a Perl script, and was wondering how to do all in R.

I have a file (call it list.txt) which contains the symbol of stock I want to get, something like this:


So in R, I read the file:

my_file <- read.table("list.txt")

so then I presume that my_file[3,1] == "ABT".

Now, if want to do something like

fh <- file(my_file[i,1],open='a')
but something seems to be wrong in this.

Any idea ?
I'm sure it's a very simple problem for any R coder .

Success requires no deodorant! (Sun Tzu)
Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
Just starting out...
Futures Experience: Intermediate
Platform: Trading Shim + R/Matlab/Python + TWS + fxTrader
Broker/Data: Interactive Brokers, Oanda
Favorite Futures: OMXS30, EUR/USD
Posts: 3 since Mar 2010
Thanks: 22 given, 4 received

sam028 View Post

so then I presume that my_file[3,1] == "ABT".

Now, if want to do something like
fh <- file(my_file[i,1],open='a')
but something seems to be wrong in this.

Any idea ?.

fh <- file(as.character(my-file[i,1]), open = 'a') should work.

Reply With Quote
The following 3 users say Thank You to Jovis for this post:


futures io > > > > basic R question

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Wyckoff Hunting for Great Risk/Reward Ratio w/Gary Fullett

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

Similar Threads
Thread Thread Starter Forum Replies Last Post
Very basic scalper set up Xzap Traders Hideout 25 November 18th, 2013 08:39 AM
Basic market characteristics aediaz1 The Elite Circle 4 August 10th, 2011 10:18 AM
Basic datafeed questions forexboom Reviews of Brokers and Data Feeds 3 May 24th, 2011 02:56 PM
Basic MACD for NT7 jmjstrider NinjaTrader 6 February 3rd, 2011 07:28 PM
Basic TimeFrame Pattern wh The Elite Circle 0 October 8th, 2009 04:39 AM

All times are GMT -4. The time now is 04:19 AM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2018-05-22 in 0.08 seconds with 19 queries on phoenix via your IP