Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (opm), 778 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Downloading and Displaying Stock Market Data #415134
01/14/13 11:19
01/14/13 11:19
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Hello,

I'm complete newbie in programming world, but I've chosen to create stock market database and the way to display those. This is my high school project, if I fail I'll fail my way to get into University. I really wanted to do everything on my own, but I've failed, I have tried some basic javascripts to find and download data off the website like google's stock market page.
Then I have moved onto cURL, but again I couldn't get it working at first, when I've won with that it wasn't ideal because it was really hard to get around. Then I have found Zorro, I really want to use it, but I don't know how.

Can anybody please help me in putting it into VSC++ and telling me how to save selected variables in the easy way for SQL use to create database? I tried some tutorials, but I can just put it all together, beside that I can't do anything smirk

sorry... smirk


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415137
01/14/13 11:28
01/14/13 11:28
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Do you need really single stocks for your project, or will currencies and stock indexes do as well? In that case you can just use Zorro's current FXCM plugin for downloading price data. FXCM has no stocks, though, so we had to find a different solution when you really need stocks.




Re: Downloading and Displaying Stock Market Data [Re: jcl] #415142
01/14/13 11:59
01/14/13 11:59
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
I was thinking of downloading currencies, prices of minerals(gold etc) and financial instruments, but I don't want to move on more than FXCM provides, it will be advanced enough, even too much, of course if it works.

Thanks for reply!


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415143
01/14/13 12:03
01/14/13 12:03
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Ok, next question is what do you want to do with the prices? A SQL database is normally not required and also not suited for storing price series.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415144
01/14/13 12:07
01/14/13 12:07
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
I wanted to create the database of downloaded data, so the database is being iteracted with, not the hole program. Next program will open the databse and display graphs, diagrams or basic tables of selected currencies/minerals etc. or all. Is that hard or would you recommend me different way?

EDIT: Display graphs, diagrams or basic tables of database of selected currencies/minerals etc or all of those

Last edited by DejaVu; 01/14/13 12:08.

A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415146
01/14/13 12:27
01/14/13 12:27
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Storing the prices in a database is not hard, but it's harder than not storing them in a database, for in the latter case you won't need all that database stuff.

For displaying graphs or tables you need no database. You just need a program, such as Zorro or even Excel, that can display data series in graphs.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415149
01/14/13 12:33
01/14/13 12:33
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
I do know that, but it's a high school project, if you show how advanced it is, how you can use that stuff and be professional you'll get a lot of marks. Btw, I'll learn some side skills and can show the program I've build with the help I asked for and what skills I have learned bla bla bla.

But if you insist I'll stay with excel, but I still have to program it, can't use ready programs.


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415258
01/15/13 21:36
01/15/13 21:36
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
When I try to compile it, just as this page tells me to, I get this:

Quote:
1>------ Build started: Project: FXCM TryFail TakeNo1, Configuration: Debug Win32 ------
1> dllmain.cpp
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(25): error C2146: syntax error : missing ';' before identifier 'time'
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(30): error C2146: syntax error : missing ';' before identifier 'time_base'
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(211): error C2146: syntax error : missing ';' before identifier 'timeStart'
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(211): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\master roshi\documents\visual studio 2010\projects\fxcm tryfail takeno1\fxcm tryfail takeno1\trading.h(211): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415286
01/16/13 14:01
01/16/13 14:01
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The errors look as if the DATE definition is missing in your code. It's in the example in the source folder - make sure to define it before including trading.h.

Look here: http://manual.zorro-trader.com/brokerplugin.htm

You do not need to compile the FXCM DLL yourself as you can find a compiled version already in the "Plugins" folder.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415295
01/16/13 18:59
01/16/13 18:59
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
As I've said, I've done all of those steps from this website, from the sections "Broker Plugin". What should I do next in order to solve problems and outline downloaded data? Okay, so how do I add on the compiled version of FXCM.dll?



A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415319
01/17/13 11:26
01/17/13 11:26
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
You must not add functions to a compiled DLL. A DLL is only meant to be called from your program which contains the functions you need.

If you have the DATE definition in your code, then I can not answer why you get error messages indicating that this definition is missing. But it might have other reasons. If you really need to compile the DLL and can't find the problem yourself, you may upload your complete VC++ 2010 project for that DLL, and I'll look into it.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415325
01/17/13 13:04
01/17/13 13:04
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
That's complicated, what would you recommend me to do? I mean I did all that's recommended to do, can you give me some step-by-step tutorial of how to compile the program which will download the data and save it in good way to produce the database? What are .dll files used for?

EDIT: Please.

Last edited by DejaVu; 01/17/13 13:04.

A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415326
01/17/13 13:07
01/17/13 13:07
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Ok, but I need to know how much experience you already have with VC++. How many programs have you written so far? And what is the deadline for your project?

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415327
01/17/13 13:13
01/17/13 13:13
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
I've done basic ones, calculators, basic arrays, basic functions, but that's all, all in Win32 console, the deadline is may, but it would be good to finish it by the half term holiday, which is in next month to get it marked by teachers and told what to improve to get more marks, also I have to do coursework all along. And thanks for helping me! grin


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415338
01/17/13 15:48
01/17/13 15:48
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Win32 console should be fine for the moment. First you need to write a console program that opens the broker DLL and downloads prices from FXCM. That should be doable in a few days even for a beginner.

Make yourself familiar with LoadLibrary and GetProcAddress - that are the two functions that you'll need. First load the DLL and call the BrokerOpen function. Post here if you encounter a problem.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415373
01/17/13 20:32
01/17/13 20:32
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Ok, I got to this:
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


Works, how do I call BrokerOpen function, because I get this after I try to run the file
Quote:
MsgBox is NULL


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415410
01/18/13 09:10
01/18/13 09:10
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
For BrokerOpen you need a different function type:

typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

and then

Code:
BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(h,"BrokerOpen");
if(BrokerOpen) {
 char brokername[50] = "";
 long version = (*BrokerOpen)(brokername,NULL,NULL);
}



You can see on the "Broker Plugin" page which functions you have and how they must be typedef'd.

For your purpose you only need BrokerLogin, BrokerAsset, and BrokerHistory.

Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415415
01/18/13 11:15
01/18/13 11:15
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(hinstDLL,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I got problem with higlighted part, you wrote h but it didn't work, I have tried to put it into as a variable-didn't work, so I put hinstDLL and when I try to run it with FXCM.dll it gives me: "Message box is NULL".

EDIT:

When I keep it this way
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(h,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I get this:
Quote:
1>------ Build started: Project: DLLtutApp, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\master roshi\documents\visual studio 2010\projects\dlltutapp\dlltutapp\main.cpp(34): error C2065: 'h' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Last edited by DejaVu; 01/18/13 18:32.

A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415468
01/19/13 08:21
01/19/13 08:21
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
When I write a code example, it is not meant for you to type it in literally. It for _understanding_ how to use the GetProcAddress mechanism. My example code does not compile and does not use your variables.

I can help you understanding how to use a DLL and download prices, but I can not write pieces of your program.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415539
01/20/13 00:49
01/20/13 00:49
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Okay, sorry, I thought it was ment to be added in. I'll work on it, as you've said, in terms of tutorials provided by website, is there everything I need?


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415609
01/21/13 09:45
01/21/13 09:45
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, the 3 functions LoadLibrary, GetProcAddress, and FreeLibrary are all you need for calling functions from a DLL. Make yourself familiar with the VC++ environment until you understand a compiler error message and know what to do.

If you can use the DLL, the next step would be using the DLL functions for logging in to the broker, and after that, for downloading the price history in a loop.

Page 1 of 3 1 2 3

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1