程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python makes new shares. I suggest you do this!

編輯:Python

I don't know if you have 「  stagging ( debt ) 」 What about your habits ? Xiaobian will often participate in the reform of stock and debt , On average, I can win several times a year

Although the chance of winning the lottery is very low , But once you win the lottery, you'll probably pick up some money , But sometimes I forget to participate in the innovation , Miss a chance to get rich ,So I need a regular reminder

The following will explain how to use Python Realize regular push of new shares ( debt ) The complete flow of messages

# 1. stagging / debt

Issuing new shares means , A company is approved to go public , Sell some shares to the market for the first time in exchange for funds , An individual or institution shall, on the day of the subscription date, pass the securities App Or offline subscription process

For ordinary investors , Participate in new shares 、 New debt has certain conditions

such as : Before the Subscription Date 2 Japan ( The subscription date is T, namely :T-2 ) front 20 Holding shares of the corresponding stock exchange for trading days 1W Only the above shares can participate in

The Shanghai stock market holds 1 Million market value can be subscribed 1000  stocks , Shenzhen Stock Exchange  5000 The market value can be subscribed 500 stocks , Securities at the time of trading App There will be a prompt about the quantity you can buy

in addition , If you want to subscribe to the gem 、 New shares of Kechuang board , You need to open the corresponding permission

New bonds refer to the subscription of newly issued bonds 、 Fund products

General bond funds are issued at a lower price , New bonds are usually not broken , Investment risk is lower than new shares , So there are more investors , Lower chance of winning the lottery

New bonds are issued by means of credit subscription , We just need to open a securities account , Even if you don't hold the market value of the stock, you can subscribe , The threshold is lower than that of new shares

# 2. Crawl the list of new shares

Target audience :

aHR0cHM6Ly9kYXRhLmVhc3Rtb25leS5jb20veGcveGcvZGVmYXVsdC5odG1s

PS: Due to less data on convertible bonds , Here, we will take the stock strike as an example

First , We analyze web data , It is found that the data of the new share list directly comes from the back-end interface , Page size and page number are variable parameters

So it's easy , Direct request interface , Get the name from the response by analyzing the interface data value 、 Stock code 、 Subscription code 、 exchange 、 plate 、 Offering price 、 Subscription time 、 Data such as the announcement date of the winning lot

import requests
import json
def start(pageNumber, pageSize):
    """
     Make a new
    :return:
    """
    url = "https://***/api/data/v1/get?***".format(
        pageSize, pageNumber
    )
    resp = json.loads(requests.request("GET", url, data={}).text).get("result")
    data = resp.get("data")
    print(data)
    #  Subscription today
    today_stocks = []
    #  Future subscription
    future_stocks = []
    for item in data:
        name = item.get("SECURITY_NAME")  #  name
        no = item.get("SECURITY_CODE")  #  Stock code
        buy_no = item.get("APPLY_CODE")  #  Subscription code
        trade_market = item.get("TRADE_MARKET")  #  exchange
        market_type = item.get("MARKET_TYPE")  #  plate
        price_pre = item.get('ISSUE_PRICE') if item.get('ISSUE_PRICE') else item.get('PREDICT_ISSUE_PRICE1')  #  Offering price
        apply_date = item.get("APPLY_DATE")  #  Subscription time
        ballot_date = item.get("BALLOT_NUM_DATE")  #  Announcement date of winning lot 

next , Classify the new shares according to the time of subscription , Divided into historical shares 、 New shares today 、 Future new shares

class TYPE(Enum):
    BEFORE = -1  #  yesterday
    TODAY = 0  #  today
    NEXT = 1  #  Tomorrow,
def date_type(date_str):
    """
     Judge the date type ( today 、 yesterday 、 Tomorrow, )
    :param date_str:
    :return:
    """
    #  today
    today = datetime.date.today()
    #  The signing date is changed to the date
    date_str = date_str.split(' ')[0]
    formatted_date_str = datetime.datetime.strptime(date_str, "%Y-%m-%d").date()
    if formatted_date_str > today:  #  future
        __type = TYPE.NEXT
    elif formatted_date_str == today:  #  today
        __type = TYPE.TODAY
    else:
        __type = TYPE.BEFORE  #  history
    return __type
...
  #  Subscription time
        if date_type(apply_date) == TYPE.TODAY:
            today_stocks.append(
                f" name :{name}, Subscription Date :{apply_date}, Offering price :{price_pre}, Stock code :{no}, Subscription code :{buy_no}, exchange :{trade_market}, Subordinate plate :{market_type}, Announcement date of winning lot :{ballot_date}")
        elif date_type(apply_date) == TYPE.NEXT:
            future_stocks.append(
                f" name :{name}, Subscription Date :{apply_date}, Offering price :{price_pre}, Stock code :{no}, Subscription code :{buy_no}, exchange :{trade_market}, Subordinate plate :{market_type}, Announcement date of winning lot :{ballot_date}")
        else:
            # print(' Historical data are not displayed !')
            pass
...

# 3. Array assembly and timing sending

We will assemble the data of today's new shares and future new shares at one time

...
#  Assembly data
    msg = ' Today, 【 New stock 】 The data are as follows :\n'
    if len(today_stocks) == 0:
        msg = " nothing \n\n"
    else:
        for index, today_stock in enumerate(today_stocks):
            msg += today_stock + "\n\n"
    msg += '*******************************\n\n Notice 【 New stock 】 The data are as follows :\n'
    if len(future_stocks) == 0:
        msg += " nothing \n\n"
    else:
        for index, future_stock in enumerate(future_stocks):
            msg += future_stock + "\n\n"
    return msg
...

then , Use enterprise wechat to register an enterprise , Create an internal group

next , Create a robot in the internal group of enterprise wechat , Get its 「 webhook 」 Address , Send the data assembled above

def send_wechat(msg):
    """ Send information to enterprise wechat """
    #  Fill in your robot's webhook link
    url = '**/send?key=22714fb6-**'
    headers = {"Content-Type": "text/plain"}
    data = {
        "msgtype": "text",
        "text": {
            "content": msg
        }
    }
    #  Send a message
    requests.post(url, headers=headers, data=json.dumps(data))

Last , Push the source code to the ECS , Use Crontab Just set a scheduled task

such as , What I set up here is every morning 9 Click to push the new news of today's new shares

# 4. To sum up

Through the above series of operations , You can automatically remind me to type new messages every day , You won't miss any chance to get rich

Of course , If you dislike the trouble of enterprise wechat , You can also write the data crawling part as a service , Through automation software and Hook Technology to push the file transfer assistant to wechat

I have uploaded all the source code in this article to the background , Enter keywords in the background 「 Little helper  」 Ask him to get , Make new shares by secret sign !

If you think the article is good , Please   give the thumbs-up 、 Share 、 Leaving a message.   Next , Because this will be the strongest driving force for me to continue to output more quality articles !

Interested students can quickly join our planet

3 Week zero basic introduction provides 10 Class

Throughout the year 12 Section interesting practical projects, including source code ,

Reward excellent every month Top3 Students send books

Professional Q & a group , The teachers in big factories teach like nannies

If not satisfied , Free refund within three days ! A year 88, Now offer 16 element

Scan to add ,3 Introduction to week zero Foundation

 Recommended reading :
introduction :  The most complete zero Foundation Python The problem of   |  Zero Basics 8 Months Python  |  Actual project  | learn Python That's the shortcut
dried food : A short comment on crawling Douban , The movie 《 The rest of us 》 | 38 year NBA Best player analysis  |    From people's expectation to public praise ! Tang Dynasty detective 3 disappointing   |  Laugh at the story of the new Yitian dragon slaying  |  Riddle answer King  | use Python Make a massive sketch of my little sister  | Mission impossible is so hot , I use machine learning to make a mini recommendation system movie
Interest : Pinball game   |  squared paper for practicing calligraphy   |  Beautiful flowers  |  Two hundred lines Python《 Cool run every day 》 game !
AI:  A robot that can write poetry  |  Color the picture  |  Forecast revenue  |  Mission impossible is so hot , I use machine learning to make a mini recommendation system movie
Gadget : Pdf turn Word, Easily handle forms and watermarks ! |  One touch html Save the page as pdf!|   bye PDF Withdrawal charges ! |  use 90 Lines of code create the strongest PDF converter ,word、PPT、excel、markdown、html One click conversion  |  Make a nail low-cost ticket reminder ! |60 Line of code to do a voice wallpaper switcher, look at my little sister every day !|

Annual hot money copy

  • 1). Oh my god !Pdf turn Word use Python Easy to handle !

  • 2). learn Python It's delicious ! I use 100 Line of code to make a website , Help people PS Travel pictures , Earn a chicken leg to eat

  • 3). Premiere billions , Hot all over the net , I analyzed 《 My sister 》, Discovered the secrets  

  • 4).80 Line code ! use Python Make a dorai A Dream separation  

  • 5). What you have to master 20 individual python Code , short , Useful  

  • 6).30 individual Python Strange sexual skills Collection  

  • 7). I summed up 80 page 《 Rookie Science Python Select dry goods .pdf》, Is dry  

  • 8). bye Python! I have to learn Go 了 !2500 Word depth analysis !

  • 9). Found a licking dog welfare ! This Python Reptile artifact is great , Automatically download sister pictures

Click to read the original , see 200 individual Python Case study !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved