コード例 #1
0
def index(request):
    b = BSE(update_codes=True)
    data_gainer_company = b.topGainers()
    data_looser_company = b.topLosers()
    company = []
    for i in data_gainer_company:
        company.append(b.getQuote(i['scripCode']))
    for i in data_looser_company:
        company.append(b.getQuote(i['scripCode']))
    if (request.method == 'POST'):
        d = request.POST['search_items']
        data = b.getQuote(d)
        search_items = True
        return render(
            request, 'index.html', {
                'data_gainer_company': data_gainer_company,
                'data_looser_company': data_looser_company,
                'search_data': data,
                'search_items': search_items
            })
    else:
        main_page = True
        return render(
            request, 'index.html', {
                'data_gainer_company': data_gainer_company,
                'data_looser_company': data_looser_company,
                'company': company,
                'main_page': main_page
            })
コード例 #2
0
from nsetools import Nse
from pprint import pprint  # just for neatness of display
from datetime import datetime, timedelta
import pandas as pd
import io
from bsedata.bse import BSE
import requests
from django import template

defaultfundprice = 0
search_term = ''
nse = Nse()
top_gainers_nse = nse.get_top_gainers()
top_losers_nse = nse.get_top_losers()
bse = BSE()
top_gainers_bse = bse.topGainers()
top_losers_bse = bse.topLosers()

##moneycontrol appfeeds
bseurl = 'http://appfeeds.moneycontrol.com/jsonapi/market/indices&ind_id=4'
nseurl = 'http://appfeeds.moneycontrol.com/jsonapi/market/indices&ind_id=9'
usdinrurl = 'https://priceapi.moneycontrol.com/pricefeed/notapplicable/currencyspot/%24%24%3BUSDINR'
goldurl = 'https://priceapi.moneycontrol.com/pricefeed/mcx/commodityfuture/GOLD?expiry=05FEB2020'

# Create your views here.


def getPageData(request, allFundList):
    page = request.GET.get('page', 1)
    paginator = Paginator(allFundList, 30)
    print(paginator.count)
コード例 #3
0
from bsedata.bse import BSE
import json
b = BSE()
print(b)

b = BSE(update_codes=True)

while True:
    main_input = int(
        input(
            "\nWhat You Want To Do\nPress 1 to Get The List Of Todays Top Gainers\nPress 2 to Get The List Of Todays Top Losers\nPress 3 to Get The List of the Scrip Code Of The Respective Companies\nPress 4 to Get the Information About The Company Stock by Providing the Scrip Code: "
        ))
    scrip_code = b.getScripCodes()
    Gainers = b.topGainers()
    Losers = b.topLosers()
    if main_input == 1:
        print(json.dumps(Gainers, sort_keys=True, indent=4))
    if main_input == 2:
        print(json.dumps(Losers, sort_keys=True, indent=4))
    if main_input == 3:
        print(json.dumps(scrip_code, sort_keys=True, indent=4))
    if main_input == 4:
        Quote = b.getQuote(
            input(
                "Please Enter The Scrip Code To Get The Information About The Company Stock: "
            ))
        print(json.dumps(Quote, sort_keys=True, indent=4))

    con = int(
        input("\nDo You Want to Continue\nPress 1 For Yes\nPress 2 For No: "))
コード例 #4
0
from bsedata.bse import BSE

b = BSE()

data = b.getScripCodes()
# print(data)

# value = b.getQuote("507685")
# # print(value)

# data1 = b.getQuote("532540")
# print(data1)

tg = b.topGainers()
# print(tg)

tl = b.topLosers()
# print(tl)

test = b.verifyScripCode("5325402")
print(test)