phamdinhkhanh / vnquant

VietNam Data Stock Market Price
378 stars 178 forks source link

New method to get stocks data from VNDirect #6

Closed nqhung291 closed 3 years ago

nqhung291 commented 3 years ago

Right now, we can crawl VNDirect's stocks data directly through their new Rest API for faster speed. This is my function to fetch API

def crawl_one_symbol(symbol, start_date, end_date):
        API_VNDIRECT = 'https://finfo-api.vndirect.com.vn/v4/stock_prices/'
        query = 'code:' + symbol + '~date:gte:' + start_date + '~date:lte:' + end_date
        delta = datetime.strptime(end_date, '%Y-%m-%d') - datetime.strptime(start_date, '%Y-%m-%d')
        params = {
            "sort": "date",
            "size": delta.days + 1,
            "page": 1,
            "q": query
        }
        res = requests.get(API_VNDIRECT, params=params)
        data = res.json()['data']
        return data
chienpm304 commented 3 years ago

            "q": query

Many thank <3

phamdinhkhanh commented 3 years ago

Amazing @nqhung291. Thank you so much!

Old-AI-194 commented 3 years ago

@nqhung291 Do you have Rest API for crawling the realtime Bid-Ask price in Derivative PriceBroad of Vndirect ? Tks !!!

phamdinhkhanh commented 3 years ago

Hello, Currently we do not have realtime Bid-Ask price in Derivatives PriceBoard. If you know the API, kindly donate to our project and quant community.

On Sun, Aug 22, 2021 at 2:28 AM Old-AI-194 @.***> wrote:

@nqhung291 https://github.com/nqhung291 Do you have Rest API for crawling the realltime Bid-Ask price in Derivative PriceBroad of Vndirect ? Tks !!!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/phamdinhkhanh/vnquant/issues/6#issuecomment-903165212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZC4RTPFPACISGOPV5KOKTT5747FANCNFSM4WAEXIXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

nttams commented 1 year ago

thanks, very helpful but I can not find any official document for this API. do you know about that? Or this API is found by dev tools in vndirect site?

DoanMinhTruong commented 9 months ago

Can you get VNI ?