Machine learning in trading: theory, models, practice and algo-trading - page 252

 
SanSanych Fomenko:

Python is great, but you need MKL4.

There is theRserve package. Here is my translation of the annotation

Rserve is a TCP/IP server that allows other programs to use R facilities from various languages without having to initialize R or reference the R library. Each connection has a separate workspace and working directory. Client implementations are available for popular languages such as C/C++ and Java. Rserve supports remote connection, authentication and file transfer.

The main goal of Rserve is to provide an interface that can be used by applications to do calculations in R. Our experience with other modes of communication has shown that there are three main things to consider when developing a new system: separation, flexibility, and speed.

It is important to separate the R system from the application itself. One reason is to avoid any dependence on the application programming language, since the own direct interface to R (Chambers, 1998) is only applicable from the C language (R Working Group Development, 2003). Another aspect comes from the fact that close integration with R is more error-prone, because the application must take into account the internals of R. On the other hand, application developers want the interface to be very flexible and to use most of R's facilities. Finally, speed is a key element because the goal is to provide the user with the desired results quickly without having to start an R session from scratch.

The client-server notion allows us to satisfy all three key requirements. Computation is done by the Rserve core, which is the server, responding to requests from clients such as applications. Communication between Rserve and the client is done through network sockets, usually over TCP/IP, but other changes are also possible. This allows the use of a central Rserve from remote computers, the use of multiple Rserve by a remote client to distribute computation, but also local communication on a single machine.

A single Rserve can serve multiple clients at the same time. Each Rserve connection gets its own data space and working directory. This means that the object created by a single connection never affects other connections. Additionally, each connection can produce local files, such as images created by the Rpaging device , without interfering with other connections. Each application can open multiple connections to handle parallel tasks.

The data transfer between the application and Rserve is done in binary form to get the speed and minimize the sum of the transferred data. Intermediate objects are stored in Rserve, so only items of interest need to be transferred to the client

In addition to communicating with the R kernel, Rserve also has integrated authentication and file transfer protocol, which makes Rserve suitable for use on individual machines. User authentication is provided to add a layer of security for remote use. File transfer allows the copying of files needed for computation or produced R from the client to the server and vice versa.

Rserve currently supports two main groups of commands for communicating with R: creating objects in R and evaluating R code. Most basic objects such as numbers, strings, or vectors can be created through direct addition creation. The content of objects is sent in binary form from the client to the server.

This provides an efficient way to transport the data needed for evaluation. All objects are always transferred by value to separate the client and server data spaces. In this way, both client and server are free to get rid of the data at any time, preventing the catastrophic failures that are inherent from other communication methods where systems share the same data physically.

The second major command group is R code evaluation. As opposed to creating an object, such code is sent in open text to Rserve and handled as if the code had been entered at the console in R. The resulting evaluation object can be passed back in binary form to the client if required. Most R types are supported, including scalar numbers, strings, vectors, lists (hence classes, data frames, etc.), lexical objects, etc. This allows Rserve to return all models back to the client. The client can decide not to get any objects that are useful by setting up intermediate objects in R that are not directly related to the client.

Rserve provides two basic error handling services. The three possible evaluation results are a successful evaluation, a runtime error on a parser error, and a code error. The state always returns to the client application to allow the appropriate action. Since Rserve is just a layer between the application and R, it is still possible to influence the handling of a runtime error in R itself, for example with an erroneous option or attempt command.

A typical use of Rserve tools should load all necessary data into R, perform calculations according to user input, such as model construction, and pass the results back to the application for display. All data and objects are persistent until the connection is closed. This allows the application to open the connection early, such as when the user first specifies a data set, pass all necessary data to the server, and respond to user input with prompt calculations of the desired models or estimates. Since the results are not in text form, there is no tedious parsing of results.

The interface to Rserve is modular and documented, giving access to Rserve from any application language or programming language that supports sockets, including current scripting and programming languages. We have implemented a client for Rserve in pure Java, which communicates through an interface to most Rserve facilities and maps all objects available in Rserve into native Java objects or classes. The use of the Java client is illustrated in the section as an example.


There is aJava packagethat gives access to this server.

Here if we rewrote this package fromJava to MKL4...., we would get real access to R from EA

So there is an article on the subject. Try it. I'm comfortable with everything through R.
 
SanSanych Fomenko:


There is a package inJava, which gives access to this server.

If we rewrote this package fromJava to MKL4...., we would get real access to R from the EA

Great command of English!

Well, take the package and rewrite it...

The problem?

 

SanSanych.

You did not translate the part about Windows systems. Because of this exception I used RServer.

 

Does anyone know why quotes can no longer be downloaded from finam?

library(rusquant)
getSymbols("SPFB.RTS",src = "Finam",period="5min",from = Sys.Date()-1)
Error in download.file(stock.URL, destfile = tmp, quiet = !verbose) :
  cannot open URL 'http://195.128.78.52/table.csv?d=d&market=1&f=table&e=.csv&dtf=1&tmf=1&MSOR=0&sep=1&sep2=1&at=1&p=3&em=17455&df=14&mf=11&yf=2016&dt=15&mt=11&yt=2016&cn=SPFB.RTS&datf=1'
In addition: Warning message:
In download.file(stock.URL, destfile = tmp, quiet = !verbose) :
  InternetOpenUrl failed: 'Не удается установить связь с сервером'
 
mytarmailS:

Does anyone know why quotes can no longer be downloaded from finam?

library(rusquant)
getSymbols("SPFB.RTS",src = "Finam",period="5min",from = Sys.Date()-1)
Error in download.file(stock.URL, destfile = tmp, quiet = !verbose) :
  cannot open URL 'http://195.128.78.52/table.csv?d=d&market=1&f=table&e=.csv&dtf=1&tmf=1&MSOR=0&sep=1&sep2=1&at=1&p=3&em=17455&df=14&mf=11&yf=2016&dt=15&mt=11&yt=2016&cn=SPFB.RTS&datf=1'
In addition: Warning message:
In download.file(stock.URL, destfile = tmp, quiet = !verbose) :
  InternetOpenUrl failed: 'Не удается установить связь с сервером'

Most likely the server ip has changed, he writes to you -server is unavailable and not pinged.

Try to replace it with the ip 78.41.196.47 or even easier prescription export.finam.ru

it works like this in your browser

78.41.196.47/table.csv?d=d&market=1&f=table&e=.csv&dtf=1&tmf=1&MSOR=0&sep=1&sep2=1&at=1&p=3&em=17455&df=14&mf=11&yf=2016&dt=15&mt=11&yt=2016&cn=SPFB.RTS&datf=1
 
mytarmailS:

Does anyone know why it is no longer possible to download quotes from finam?

I'm sorry, I should have just updated the package, something changed there....

I was dumb...

 
Vladimir Perervenko:
There is an article on this topic. Try it. I'm comfortable with everything through R.
Can you give me a concrete example?
 
Vladimir Perervenko:

SanSanych.

You did not translate the part about Windows systems. Because of this exception I used RServer.

RServer is not available for version 3.3.2
 
mytarmailS:

I'm sorry, I should have just updated the package, something changed there....

stupid...

Kinda like quality quotes from here
Архив котировок - GKFX
Архив котировок - GKFX
  • www.gkfx.ru
Довольно часто трейдеры сталкиваются с необходимостью получить архив котировок по тому или иному торговому инструменту за определенный исторический период. Архив котировок позволяет протестировать механические/автоматические торговые системы ("эксперты") на исторических данных и оптимизировать торговые стратегии. В данном разделе сайта Вы...
 
SanSanych Fomenko:
Kind of quality quotes from here
I do not need archives I need real time
Reason: