Trade FOREX with FXCM

  • Award-Winning Platform
  • 24/7 Customer Support
  • Trade Directly on Charts
  • Free $50K Practice Account
Register


Results 1 to 10 of 10

Thread: get history price from datetime to datetime

  1. #1
    foongshen is offline Member
    Join Date
    Apr 2012
    Posts
    29

    get history price from datetime to datetime

    hi, currently i were try to get history price from "2012-05-01 00:00:00" to "2012-05-22 23:59:59". But after i run the sample code C:\Program Files (x86)\Candleworks\ForexConnectAPI\samples\java\SimpleSamples\GetHistPrices, what i get at below...

    Code:
    Connecting to MICR564176001 *** http://www.fxcorporate.com/Hosts.jsp DEMO  
    Status: CONNECTING 
    Status: CONNECTED 
    Market data snapshot for EUR/USD, timeframe t1, from Tue May 01 00:00:00 SGT 2012, to Tue May 22 23:59:59 SGT 2012, maximum Bars 300
    Date=5/22/12 11:58 PM,BidOpen=1.273,BidHigh=1.273,BidLow=1.273,BidClose=1.273,AskOpen=1.274,AskHigh=1.274,AskLow=1.274,AskClose=1.274
    
    ......
    
    Date=5/22/12 11:59 PM,BidOpen=1.273,BidHigh=1.273,BidLow=1.273,BidClose=1.273,AskOpen=1.274,AskHigh=1.274,AskLow=1.274,AskClose=1.274
    Done!
    Status: DISCONNECTING 
    Status: DISCONNECTED
    So, may i know where do i did incorrectly..

    thanks

    NOTE : API Version : FX Connect 1.0.3 (Beta)

  2. #2
    Natalya is online now Member
    Join Date
    Apr 2009
    Posts
    747
    This is an issue in the sample for version 1.0.3. Please see the corrected version in the attachment.

    GetHistPrices.zip
    Last edited by Natalya; 05-24-2012 at 08:21 AM.

  3. #3
    foongshen is offline Member
    Join Date
    Apr 2012
    Posts
    29
    hi, thanks for ur sample. But what i get still same and from datetime is "05/02/11 03:00:00" to datetime is "05/02/11 03:01:00". anyway, i also upload my log file for refrence. hope that can help.

    thanks

    Quote Originally Posted by Natalya View Post
    This is an issue in the sample for version 1.0.3. Please see the corrected version in the attachment.

    GetHistPrices.zip
    Attached Files Attached Files

  4. #4
    Natalya is online now Member
    Join Date
    Apr 2009
    Posts
    747
    Could you please also try the modified sample from the attachment and post the received log (please change the login and password in build.xml before using)
    Attached Files Attached Files

  5. #5
    SRKASE is offline Registered User
    Join Date
    Aug 2007
    Posts
    1
    Hi Nat, lis there a similar sample for excel vba please.

  6. #6
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    Hi SRKASE,

    we will write sample and give it to you tomorrow.

    Best regards,
    Ekaterina

  7. #7
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    Hi SRKASE,

    Here is the 'Get historic prices' sample for Excel vba.
    Attached Files Attached Files

  8. #8
    FFFtrader is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Hi there,
    I am also running into issues with the "gethistprices" sample. I am using the classes that Natalya updated and posted earlier in this thread. In Natalya's gethistprices zip file, I'm having issues with the Main class.

    Here's the issue I'm running into (I javadoced in my code and I'm just copying and pasting that javadoc):

    PHP Code:

                
    /**
                 * Java error at the mSession = 02GTransport.createSession() line:
                 * Exception in thread "main" java.lang.UnsatisfiedLinkError: no gstool2 in java.library.path
                 * at java.lang.ClassLoader.loadLibrary(Unknown Source)
                 * at java.lang.Runtime.loadLibrary0(Unknown Source)
                 * at java.lang.System.loadLibrary(Unknown Source)
                 * at com.fxcore2.O2GTransport.<clinit>(Unknown Source)
                 * at com.fxcore2.tests.Main.main(Main.java:130) 
                 * 
                 * (Main.java.130) or line 130 was originally the 
                 * mSession = 02GTransport.createSession() line before I inputed this javadoc.
                 * 
                 */ 
    This error brings up another concern: when I added my external JAR files, the library seemed to import ok but it didn't seem to configure properly. When I attempt to go into the fxcore2 library in Eclipse and view the code of the classes, the classes aren't available for viewing. A page comes up in Eclipse that says "Class File Editor" and "Source not found". There's a button that says "Attach Source.." and when I try to attach it, there is no .java or .class file for the particular class. I have already tried reinstalling the Java API and no luck with that.

    Any help or input would be appreciated!

    Thanks,
    P

  9. #9
    FFFtrader is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Regarding my previous post, I sought out additional help and learned the fxcore2 classes are licensed and therefore hidden due to copyright (or similar) reasons.

    What's strange (to me) is the mSession = O2GTransport.createSession();, the line in my code that's giving me an error in the "gethistprices" sample main class, works just fine in the "login" sample main class. In other words, the same code for the mSession field works when I login, but it doesn't work when trying to pull historical data.

    I continue to get the error displayed in the javadoc in the previous post.

    Any ideas or possible solutions would be greatly appreciated. Thanks.

  10. #10
    Natalya is online now Member
    Join Date
    Apr 2009
    Posts
    747
    It looks like the working directory was not set properly. To learn how to do this, please read How to Start Using ForexConnect in Java

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.