9 thoughts on “Cập nhật StockViewer 0.7

  1. Anh Nam cho em hỏi là anh viết phần mềm này như thế nào vậy? Em đang làm đồ án về cái này nên rất cần.

  2. Em muốn hỏi về phần nào? Các lấy dữ liệu? Cách hiển thị hay cái gì?

  3. Anh lấy dữ liệu từ trang này đó em: http://www.hsx.vn/hsx/HOSE_Livesecurity.htm
    Em có thể mở code của nó ra xem để xem nó lấy dữ liệu và cách xử lý như thế nào.
    Các dữ liệu này được gọi từ 1 ws: http://www.vse.org.vn/LS/HoSTC_Service.asmx. Nó cung cấp 3 function: GetListStockWarning, GetLiveSecurity, GetLiveTotalMKT.
    Hàm GetLiveSecurity trả về chuỗi chứa dữ liệu chứng khoán, em có thể dùng lớp sau để tách chuỗi này:
    public class HoSTCStringParser
    {
    private string _s;

    public HoSTCStringParser(string s)
    {
    _s = s;
    }

    public List GetListOfItems()
    {
    string[] ss = _s.Split(new string[] { “**” }, StringSplitOptions.RemoveEmptyEntries);
    StockItem[] results = new StockItem[ss.Length];
    List list = new List();

    Parallel.For(0, ss.Length, i =>
    {
    if (!string.IsNullOrEmpty(ss[i]))
    results[i] = ParseItem(ss[i]);
    });
    list.AddRange(results);

    //foreach (string s in ss)
    //{
    // if (!string.IsNullOrEmpty(s))
    // list.Add(ParseItem(s));
    //}

    return list;
    }

    private StockItem ParseItem(string s)
    {
    int currentIdx = 0;
    int idx = s.IndexOf(“|”, currentIdx);

    if (idx == -1)
    return null;

    string id;
    string thamchieu;
    string tran;
    string san;
    string muagia3;
    string muakhoiluong3;
    string muagia2;
    string muakhoiluong2;
    string muagia1;
    string muakhoiluong1;
    string giakhop;
    string klth;
    string tanggiam;
    string bangia3;
    string bankhoiluong3;
    string bangia2;
    string bankhoiluong2;
    string bangia1;
    string bankhoiluong1;
    string mocua;
    string caonhat;
    string thapnhat;
    string tklgd;

    id = s.Substring(currentIdx, idx – currentIdx).Trim();

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    thamchieu = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    tran = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    san = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muagia3 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muakhoiluong3 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muagia2 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muakhoiluong2 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muagia1 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    muakhoiluong1 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    giakhop = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    klth = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    tanggiam = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bangia1 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bankhoiluong1 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bangia2 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bankhoiluong2 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bangia3 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    bankhoiluong3 = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    mocua = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    caonhat = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    thapnhat = s.Substring(currentIdx, idx – currentIdx);

    currentIdx = idx + 1;
    idx = s.IndexOf(“|”, currentIdx);
    tklgd = s.Substring(currentIdx, idx – currentIdx);

    return new StockItem(id, thamchieu, tran, san, muagia1, muakhoiluong1, muagia2, muakhoiluong2,
    muagia3, muakhoiluong3, giakhop, klth, tanggiam, bangia1, bankhoiluong1, bangia2,
    bankhoiluong2, bangia3, bankhoiluong3, mocua, caonhat, thapnhat, tklgd, “”, “”);

    }
    }
    Em có thể new 1 object với tham số là chuỗi nhận được, rồi gọi GetListOfItems, mỗi item là một StockItem (xem ở dưới), lấy và hiển thị là xong.
    public class StockItem
    {
    public StockItem(string id, string thamchieu, string tran, string san, string muagia1, string muakhoiluong1, string muagia2, string muakhoiluong2, string muagia3, string muakhoiluong3, string giakhop, string klth, string tanggiam, string bangia1, string bankhoiluong1, string bangia2, string bankhoiluong2, string bangia3, string bankhoiluong3, string mocua, string caonhat, string thapnhat, string tklgd, string nuocngoaimua, string nuocngoairoom);

    public string Bangia1 { get; }
    public string Bangia1_AsText { get; }
    public string Bangia2 { get; }
    public string Bangia2_AsText { get; }
    public string Bangia3 { get; }
    public string Bangia3_AsText { get; }
    public string Bankhoiluong1 { get; }
    public string Bankhoiluong1_AsText { get; }
    public string Bankhoiluong2 { get; }
    public string Bankhoiluong2_AsText { get; }
    public string Bankhoiluong3 { get; }
    public string Bankhoiluong3_AsText { get; }
    public string CanhBao { get; set; }
    public string Caonhat { get; }
    public string GhiChuCanhBao { get; set; }
    public string Giakhop { get; }
    public string Giakhop_AsText { get; }
    public string Id { get; }
    public bool IsBangia1GtThamchieu { get; }
    public bool IsBangia1StThamchieu { get; }
    public bool IsBangia2GtThamchieu { get; }
    public bool IsBangia2StThamchieu { get; }
    public bool IsBangia3GtThamchieu { get; }
    public bool IsBangia3StThamchieu { get; }
    public bool IsChanged { get; set; }
    public bool IsDecreasing { get; }
    public bool IsIncreasing { get; }
    public bool IsMuagia1GtThamchieu { get; }
    public bool IsMuagia1StThamchieu { get; }
    public bool IsMuagia2GtThamchieu { get; }
    public bool IsMuagia2StThamchieu { get; }
    public bool IsMuagia3GtThamchieu { get; }
    public bool IsMuagia3StThamchieu { get; }
    public string Klth { get; }
    public string Mocua { get; }
    public string Muagia1 { get; }
    public string Muagia1_AsText { get; }
    public string Muagia2 { get; }
    public string Muagia2_AsText { get; }
    public string Muagia3 { get; }
    public string Muagia3_AsText { get; }
    public string Muakhoiluong1 { get; }
    public string Muakhoiluong1_AsText { get; }
    public string Muakhoiluong2 { get; }
    public string Muakhoiluong2_AsText { get; }
    public string Muakhoiluong3 { get; }
    public string Muakhoiluong3_AsText { get; }
    public string Name { get; set; }
    public string Nuocngoaimua { get; }
    public string Nuocngoaimua_AsText { get; }
    public string NuocngoaiRoom { get; }
    public string Nuocngoairoom_AsText { get; }
    public string San { get; }
    public string Tanggiam { get; }
    public string Tanggiam_AsText { get; }
    public string Thamchieu { get; }
    public string Thapnhat { get; }
    public string Tklgd { get; }
    public string Tklgd_AsText { get; }
    public string ToolTip { get; }
    public string Tran { get; }

    public override bool Equals(object obj);
    }

  4. Em cảm ơn anh rất nhiều!
    Anh cho em hỏi câu hơi gà chút!
    Anh kêu em mở code trang http://www.hsx.vn/hsx/HOSE_Livesecurity.htm xem code của nó để mình xác định đâu là trang web service của nó phải không anh. Tức đây là cách để sau này mình tìm trang web service của trang web.

  5. Anh Nam cho em hỏi anh kết nối đến web service của như thế nào vậy? Em dùng jquery để kết nối lấy dữ liệu từ web service của nó về nhưng không được. Mong anh chỉ giúp!

  6. As you learn more and more about the platform, take notes and come up with ideas on how to use it better.

    I recommend using a simple font that is easy to read in a size ranging
    from 32 to 40. For example, if your food business is dedicated to gourmet
    party appetizers your bio might be as simple as “Gourmet appetizers delivered right to your door.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s