• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Streaming data records"

Collapse

  • Zippy
    replied
    Originally posted by Lightship
    Yes, but can you do it with much cheapness and plenty quickness?
    No and no

    Leave a comment:


  • Zippy
    replied
    Originally posted by Jaws View Post
    So essentially, you want to insert a row in to a table whenever a message is received and you need a book or the internet for that?

    There's a painfully obvious error in the code you've pasted in here, I guess you may be losing exceptions because it's probably running in a different thread.
    I think even I have spotted it

    I know very little about Java.

    Leave a comment:


  • Jaws
    replied
    Originally posted by Pumbaa View Post
    But for me it's crazy that in all books (even in Horstmann & Cornell Core Java Advanced Features) and Internet described only how to work with database, but nowhere how to feed it with streaming data. And only the command which I found to put new data is INSERT. All other only for work with existing data. Sorry for expression, but I'm trying to find solution from Monday.
    So essentially, you want to insert a row in to a table whenever a message is received and you need a book or the internet for that?

    There's a painfully obvious error in the code you've pasted in here, I guess you may be losing exceptions because it's probably running in a different thread.

    Leave a comment:


  • Pumbaa
    replied
    No, this is my first experience. But I've already studied most basic commands of MySQL and logic how to use them. Unfortunately all courses oriented for extracting and comparing data, but no one for feeding. But to start any analytical research I have to collect data.

    Leave a comment:


  • doodab
    replied
    Have you worked with SQL databases before?

    Perhaps you should take a look at hibernate or JPA?

    Leave a comment:


  • Pumbaa
    replied
    PHP Code:
    public class ClientTester {

        private static List 
    accounts = new ArrayList();
        private static 
    String accountMassID;
        private static 
    String openOrderMassID;
        private static 
    String openPositionMassID;
        private static 
    String closedPositionMassID;
        private static 
    String tradingSessionStatusID;
        private static 
    TradingSessionStatus tradingSessionStatus;
        private static 
    boolean printMarketData false;

        public static 
    void main(final String[] args) {
            
    System.out.println("startctc");
            
    // step 1: get an instance of IGateway from the GatewayFactory
            
    final IGateway fxcmGateway GatewayFactory.createGateway();

            
    /*
            step 2: register a generic message listener with the gateway, this
            listener in particular gets all messages that are related to the trading
            platform MarketDataSnapshot,OrderSingle,ExecutionReport, etc...
             */
            
    fxcmGateway.registerGenericMessageListener(new IGenericMessageListener() {

                public 
    void messageArrived(ITransportable message) {
                    if (
    message instanceof MarketDataSnapshot) {
                        
    MarketDataSnapshot incomingQuote = (MarketDataSnapshotmessage;
                        if (
    printMarketData || incomingQuote.getMDReqID() != null) {
                            try {

                                
    ConnectDB conn = new ConnectDB();
                                
    String sql null;
                                
    conn.insert(sql);
                                
    sql "INSERT INTO Sample5 (`QuoteID`, `Symbol`, `BidPx`, `OfferPx`, `TimeStamp`) VALUES ('" incomingQuote.getQuoteID() + "','" incomingQuote.getInstrument().getSymbol() + "','" incomingQuote.getAskOpen() + "','" incomingQuote.getBidOpen() + "','" incomingQuote.getOpenTimestamp() + "')"
    this is standard connection procedure for FXCM streaming server with supplied code and all quotes comes perfect, means we have source of data. I'm only add from ConnectDB conn = new ConnectDB;
    But for me it's crazy that in all books (even in Horstmann & Cornell Core Java Advanced Features) and Internet described only how to work with database, but nowhere how to feed it with streaming data. And only the command which I found to put new data is INSERT. All other only for work with existing data. Sorry for expression, but I'm trying to find solution from Monday.

    Leave a comment:


  • rsingh
    replied
    OK then,

    What methods and events have you got on your IncomingQuotes class?

    Leave a comment:


  • Spacecadet
    replied
    sounds like you just need an infinite loop with break clauses

    Leave a comment:


  • Pumbaa
    replied
    Streaming data

    I'm not in a hurry, so I have time to study, just if you know, give me idea from where to start to search, because in available sources about Java and MySQL I can't find any information about recording of streaming data. I believe that everything very simple and logical, but very important to find proper point of start.

    Leave a comment:


  • rsingh
    replied
    Originally posted by Pumbaa View Post
    Please advise right code to put in Java Listener class to send all incoming steaming quotes to MySQL database.
    When I put :
    conn.insert(sql);
    sql = "INSERT INTO MarketData (`No`, `Symbol`, `BidPx`, `OfferPx`, `TimeStamp`) VALUES ('"+ incomingQuote.getQuoteID() + "','" + incomingQuote.getInstrument().getSymbol() + "','" + incomingQuote.getAskOpen() + "','" + incomingQuote.getBidOpen() + "','" + incomingQuote.getOpenTimestamp() + "')";
    Java send to DB only one record for each pair and after stops sending. Means I can see quotes on terminal display but they are not collecting in database.
    When I stop JM and restart I have another one set of quotes.
    In order for anybody to help you, you will need to provide a lot more information than you have done.

    I don't think you realise how much that snippet of code reveals about the code quality in the system that you are working on. If that is the type of code that you are putting into a production system, I suggest you give up programming now.

    Leave a comment:


  • Pumbaa
    started a topic Streaming data records

    Streaming data records

    Please advise right code to put in Java Listener class to send all incoming steaming quotes to MySQL database.
    When I put :
    conn.insert(sql);
    sql = "INSERT INTO MarketData (`No`, `Symbol`, `BidPx`, `OfferPx`, `TimeStamp`) VALUES ('"+ incomingQuote.getQuoteID() + "','" + incomingQuote.getInstrument().getSymbol() + "','" + incomingQuote.getAskOpen() + "','" + incomingQuote.getBidOpen() + "','" + incomingQuote.getOpenTimestamp() + "')";
    Java send to DB only one record for each pair and after stops sending. Means I can see quotes on terminal display but they are not collecting in database.
    When I stop JM and restart I have another one set of quotes.

Working...
X