Results 1 to 6 of 6

Hybrid View

  1. #1
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    We still have problems in understanding the question.
    A "schema" is a list of fields to be subscribed to by the client, hence it's not clear what you mean by "create instant of Schema1".
    By each "launcher" are you referring to a distinct Remote Server instance?
    Then no, a single Data Adapter (hence, a single Remote Server) must be used to supply all the items that a single client requires. A single Data Adapter can handle subscriptions for multiple items and feed each item with the proper fields.
    Your Data Adapter should be able to distinguish different kinds of items based on their name and supply field values accordingly. Upon subscribe("CodeItem1") it should supply Code=ABD Ref=10 Ce=12 Fl=8 and upon subscribe("ItemIndex1") it should supply Session=1 Index=1006 IndexChange=6

  2. #2
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Skidrow406,
    I'm not sure understand your question, but in my opion, u mean (see picture below) :
    You have 2 schema (something like that) :
    ----
    var schema = ["last_price", "time", "_change", "bid1vol", "bid1", "ask1", "ask1vol", "min", "max", "ref_price", "open_price", "stock_symbol", "ceiling" , "floor", "bid2vol", ...,"item_status"];

    var schema2 = ["vnindex", "idxVol", "idxVal","idxchange", "item_status"];

    -----

    ---
    I think u need created 2 class :
    ---
    public class IndexProducer
    {


    private IExternalFeedListener _listener;

    public IndexProducer(Int32 vnIndex, Int64 TotalShare, Int64 TotalValue, Int32 idxTime)
    {
    ...
    }

    public void SetFeedListener(IExternalFeedListener listener)
    {
    lock (this)
    {
    _listener = listener;
    }
    }

    public IDictionary GetCurrentValues(bool fullData)
    {
    lock (this)
    {
    IDictionary eventData = new Hashtable();

    if (fullData)
    {
    ...
    }
    return eventData;
    }
    }

    }

    ----

    public class ExternalFeedProducer
    {
    ...

    private IExternalFeedListener _listener;


    public ExternalFeedProducer(string name, Int32 openPrice, ... string status)
    {

    ...

    }

    public string GetItemName() {
    return _itemName;
    }

    public void SetFeedListener(IExternalFeedListener listener) {
    lock (this) {
    _listener = listener;
    }
    }



    public IDictionary GetCurrentValues(bool fullData)
    {
    ReadINIFile settings;
    lock (this)
    {
    IDictionary eventData = new Hashtable();

    ...

    if (fullData)
    {

    ...


    }
    return eventData;
    }
    }
    }

    And then
    -------
    public void Run()
    {

    ...

    //for each stock
    for (int i=0; i < nStock; i++)
    {
    //create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
    string itemName= "item" + (i + 1);

    ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName, _openprices[i], .., _status[i]);

    _stockGenerators[itemName]= myProducer;

    //call onEvent on the listener and send the IDictionary
    _listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);

    }
    //for each Index
    for (int i=0; i < nStock; i++)
    {
    //create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
    string itemName= "indexItem" + (i + 1);

    IndexProducer myProducer = new IndexProducer (itemName,...);

    _stockGenerators[itemName]= myProducer;

    //call onEvent on the listener and send the IDictionary
    _listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);

    }
    ...
    }

    That's right?

  3. #3
    Member
    Join Date
    Nov 2007
    Location
    VN
    Posts
    12
    thanks DarioCrivelli & tuongkha
    I understood your ideal, DarioCrivelli
    so that I have only 1 schema and I feed data upon the itemname from client
    Code:
    Item        Code  Ref Ce Fl Session Index IndexChange
    -----------------------------------------------------
    CodeItem1   ABC   10  12 8  0       0     0
    CodeItem2   XYZ   20  24 16 0       0     0
    IndexItem1  0     0   0  0  1       1006  6
    IndexItem2  0     0   0  0  2       1007  7
    I will try this solution!
    Thanks again!

 

 

Similar Threads

  1. Replies: 5
    Last Post: April 30th, 2010, 10:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:02 PM.