refactor: remove unused fields from BondData struct and update database schema for improved clarity and maintainability
This commit is contained in:
parent
a35dfc74f0
commit
9c589714ce
@ -11,73 +11,6 @@ type BondData struct {
|
||||
SecuCode string `json:"SECUCODE" db:"SecuCode"`
|
||||
TradeMarket string `json:"TRADE_MARKET" db:"TradeMarket"`
|
||||
SecurityNameAbbr string `json:"SECURITY_NAME_ABBR" db:"SecurityNameAbbr"`
|
||||
// DelistDate *CustomTime `json:"DELIST_DATE" db:"DelistDate"`
|
||||
ListingDate *CustomTime `json:"LISTING_DATE" db:"ListingDate"`
|
||||
ConvertStockCode string `json:"CONVERT_STOCK_CODE" db:"ConvertStockCode"`
|
||||
BondExpire string `json:"BOND_EXPIRE" db:"BondExpire"`
|
||||
Rating string `json:"RATING" db:"Rating"`
|
||||
ValueDate CustomTime `json:"VALUE_DATE" db:"ValueDate"`
|
||||
IssueYear string `json:"ISSUE_YEAR" db:"IssueYear"`
|
||||
CeaseDate CustomTime `json:"CEASE_DATE" db:"CeaseDate"`
|
||||
ExpireDate CustomTime `json:"EXPIRE_DATE" db:"ExpireDate"`
|
||||
PayInterestDay string `json:"PAY_INTEREST_DAY" db:"PayInterestDay"`
|
||||
InterestRateExplain string `json:"INTEREST_RATE_EXPLAIN" db:"InterestRateExplain"`
|
||||
BondCombineCode string `json:"BOND_COMBINE_CODE" db:"BondCombineCode"`
|
||||
ActualIssueScale float64 `json:"ACTUAL_ISSUE_SCALE" db:"ActualIssueScale"`
|
||||
IssuePrice float64 `json:"ISSUE_PRICE" db:"IssuePrice"`
|
||||
Remark string `json:"REMARK" db:"Remark"`
|
||||
ParValue float64 `json:"PAR_VALUE" db:"ParValue"`
|
||||
IssueObject string `json:"ISSUE_OBJECT" db:"IssueObject"`
|
||||
// RedeemType *string `json:"REDEEM_TYPE" db:"RedeemType"`
|
||||
// ExecuteReasonHS *string `json:"EXECUTE_REASON_HS" db:"ExecuteReasonHS"`
|
||||
// NoticeDateHS *CustomTime `json:"NOTICE_DATE_HS" db:"NoticeDateHS"`
|
||||
// NoticeDateSH *CustomTime `json:"NOTICE_DATE_SH" db:"NoticeDateSH"`
|
||||
// ExecutePriceHS *float64 `json:"EXECUTE_PRICE_HS" db:"ExecutePriceHS"`
|
||||
// ExecutePriceSH *float64 `json:"EXECUTE_PRICE_SH" db:"ExecutePriceSH"`
|
||||
// RecordDateSH *CustomTime `json:"RECORD_DATE_SH" db:"RecordDateSH"`
|
||||
// ExecuteStartDateSH *CustomTime `json:"EXECUTE_START_DATESH" db:"ExecuteStartDateSH"`
|
||||
// ExecuteStartDateHS *CustomTime `json:"EXECUTE_START_DATEHS" db:"ExecuteStartDateHS"`
|
||||
// ExecuteEndDate *CustomTime `json:"EXECUTE_END_DATE" db:"ExecuteEndDate"`
|
||||
CorreCode string `json:"CORRECODE" db:"CorreCode"`
|
||||
CorreCodeNameAbbr string `json:"CORRECODE_NAME_ABBR" db:"CorreCodeNameAbbr"`
|
||||
PublicStartDate CustomTime `json:"PUBLIC_START_DATE" db:"PublicStartDate"`
|
||||
CorreCodeO string `json:"CORRECODEO" db:"CorreCodeO"`
|
||||
CorreCodeNameAbbrO string `json:"CORRECODE_NAME_ABBRO" db:"CorreCodeNameAbbrO"`
|
||||
BondStartDate CustomTime `json:"BOND_START_DATE" db:"BondStartDate"`
|
||||
SecurityStartDate CustomTime `json:"SECURITY_START_DATE" db:"SecurityStartDate"`
|
||||
SecurityShortName string `json:"SECURITY_SHORT_NAME" db:"SecurityShortName"`
|
||||
FirstPerPreplacing float64 `json:"FIRST_PER_PREPLACING" db:"FirstPerPreplacing"`
|
||||
OnlineGeneralAAU float64 `json:"ONLINE_GENERAL_AAU" db:"OnlineGeneralAAU"`
|
||||
OnlineGeneralLWR float64 `json:"ONLINE_GENERAL_LWR" db:"OnlineGeneralLWR"`
|
||||
InitialTransferPrice float64 `json:"INITIAL_TRANSFER_PRICE" db:"InitialTransferPrice"`
|
||||
TransferEndDate CustomTime `json:"TRANSFER_END_DATE" db:"TransferEndDate"`
|
||||
TransferStartDate CustomTime `json:"TRANSFER_START_DATE" db:"TransferStartDate"`
|
||||
ResaleClause string `json:"RESALE_CLAUSE" db:"ResaleClause"`
|
||||
RedeemClause string `json:"REDEEM_CLAUSE" db:"RedeemClause"`
|
||||
PartyName string `json:"PARTY_NAME" db:"PartyName"`
|
||||
ConvertStockPrice interface{} `json:"CONVERT_STOCK_PRICE" db:"ConvertStockPrice"`
|
||||
TransferPrice float64 `json:"TRANSFER_PRICE" db:"TransferPrice"`
|
||||
TransferValue float64 `json:"TRANSFER_VALUE" db:"TransferValue"`
|
||||
CurrentBondPrice interface{} `json:"CURRENT_BOND_PRICE" db:"CurrentBondPrice"`
|
||||
TransferPremiumRatio float64 `json:"TRANSFER_PREMIUM_RATIO" db:"TransferPremiumRatio"`
|
||||
// ConvertStockPriceHQ *float64 `json:"CONVERT_STOCK_PRICEHQ" db:"ConvertStockPriceHQ"`
|
||||
// Market *string `json:"MARKET" db:"Market"`
|
||||
ResaleTrigPrice float64 `json:"RESALE_TRIG_PRICE" db:"ResaleTrigPrice"`
|
||||
RedeemTrigPrice float64 `json:"REDEEM_TRIG_PRICE" db:"RedeemTrigPrice"`
|
||||
PBVRatio float64 `json:"PBV_RATIO" db:"PBVRatio"`
|
||||
IBStartDate CustomTime `json:"IB_START_DATE" db:"IBStartDate"`
|
||||
IBEndDate CustomTime `json:"IB_END_DATE" db:"IBEndDate"`
|
||||
CashflowDate CustomTime `json:"CASHFLOW_DATE" db:"CashflowDate"`
|
||||
CouponIR float64 `json:"COUPON_IR" db:"CouponIR"`
|
||||
ParamName string `json:"PARAM_NAME" db:"ParamName"`
|
||||
IssueType string `json:"ISSUE_TYPE" db:"IssueType"`
|
||||
ExecuteReasonSH *string `json:"EXECUTE_REASON_SH" db:"ExecuteReasonSH"`
|
||||
PaydayNew string `json:"PAYDAYNEW" db:"PaydayNew"`
|
||||
CurrentBondPriceNew interface{} `json:"CURRENT_BOND_PRICENEW" db:"CurrentBondPriceNew"`
|
||||
IsConvertStock string `json:"IS_CONVERT_STOCK" db:"IsConvertStock"`
|
||||
IsRedeem string `json:"IS_REDEEM" db:"IsRedeem"`
|
||||
IsSellback string `json:"IS_SELLBACK" db:"IsSellback"`
|
||||
FirstProfit *float64 `json:"FIRST_PROFIT" db:"FirstProfit"`
|
||||
}
|
||||
|
||||
type CustomTime struct {
|
||||
|
@ -24,73 +24,6 @@ func init() {
|
||||
SecuCode VARCHAR(15) NOT NULL,
|
||||
TradeMarket VARCHAR(10) NOT NULL,
|
||||
SecurityNameAbbr VARCHAR(50) NOT NULL,
|
||||
DelistDate DATETIME NULL,
|
||||
ListingDate DATETIME NULL,
|
||||
ConvertStockCode VARCHAR(10) NOT NULL,
|
||||
BondExpire VARCHAR(5) NOT NULL,
|
||||
Rating VARCHAR(5) NOT NULL,
|
||||
ValueDate DATETIME NOT NULL,
|
||||
IssueYear VARCHAR(4) NOT NULL,
|
||||
CeaseDate DATETIME NOT NULL,
|
||||
ExpireDate DATETIME NOT NULL,
|
||||
PayInterestDay VARCHAR(10) NOT NULL,
|
||||
InterestRateExplain TEXT NOT NULL,
|
||||
BondCombineCode VARCHAR(20) NOT NULL,
|
||||
ActualIssueScale DECIMAL(10, 2) NOT NULL,
|
||||
IssuePrice DECIMAL(10, 2) NOT NULL,
|
||||
Remark TEXT NOT NULL,
|
||||
ParValue DECIMAL(10, 2) NOT NULL,
|
||||
IssueObject TEXT NOT NULL,
|
||||
RedeemType VARCHAR(50) NULL,
|
||||
ExecuteReasonHS VARCHAR(255) NULL,
|
||||
NoticeDateHS DATETIME NULL,
|
||||
NoticeDateSH DATETIME NULL,
|
||||
ExecutePriceHS DECIMAL(10, 2) NULL,
|
||||
ExecutePriceSH DECIMAL(10, 2) NULL,
|
||||
RecordDateSH DATETIME NULL,
|
||||
ExecuteStartDateSH DATETIME NULL,
|
||||
ExecuteStartDateHS DATETIME NULL,
|
||||
ExecuteEndDate DATETIME NULL,
|
||||
CorreCode VARCHAR(10) NOT NULL,
|
||||
CorreCodeNameAbbr VARCHAR(50) NOT NULL,
|
||||
PublicStartDate DATETIME NOT NULL,
|
||||
CorreCodeO VARCHAR(10) NOT NULL,
|
||||
CorreCodeNameAbbrO VARCHAR(50) NOT NULL,
|
||||
BondStartDate DATETIME NOT NULL,
|
||||
SecurityStartDate DATETIME NOT NULL,
|
||||
SecurityShortName VARCHAR(50) NOT NULL,
|
||||
FirstPerPreplacing DECIMAL(10, 4) NOT NULL,
|
||||
OnlineGeneralAAU DECIMAL(10, 2) NOT NULL,
|
||||
OnlineGeneralLWR DECIMAL(20, 10) NOT NULL,
|
||||
InitialTransferPrice DECIMAL(10, 2) NOT NULL,
|
||||
TransferEndDate DATETIME NOT NULL,
|
||||
TransferStartDate DATETIME NOT NULL,
|
||||
ResaleClause TEXT NOT NULL,
|
||||
RedeemClause TEXT NOT NULL,
|
||||
PartyName VARCHAR(100) NOT NULL,
|
||||
ConvertStockPrice DECIMAL(10, 2) NOT NULL,
|
||||
TransferPrice DECIMAL(10, 2) NOT NULL,
|
||||
TransferValue DECIMAL(10, 4) NOT NULL,
|
||||
CurrentBondPrice VARCHAR(10) NOT NULL,
|
||||
TransferPremiumRatio DECIMAL(10, 2) NOT NULL,
|
||||
ConvertStockPriceHQ DECIMAL(10, 2) NULL,
|
||||
Market VARCHAR(50) NULL,
|
||||
ResaleTrigPrice DECIMAL(10, 2) NOT NULL,
|
||||
RedeemTrigPrice DECIMAL(10, 2) NOT NULL,
|
||||
PBVRatio DECIMAL(10, 2) NOT NULL,
|
||||
IBStartDate DATETIME NOT NULL,
|
||||
IBEndDate DATETIME NOT NULL,
|
||||
CashflowDate DATETIME NOT NULL,
|
||||
CouponIR DECIMAL(10, 2) NOT NULL,
|
||||
ParamName TEXT NOT NULL,
|
||||
IssueType VARCHAR(10) NOT NULL,
|
||||
ExecuteReasonSH VARCHAR(255) NULL,
|
||||
PaydayNew VARCHAR(10) NOT NULL,
|
||||
CurrentBondPriceNew DECIMAL(10, 2) NOT NULL,
|
||||
IsConvertStock VARCHAR(10) NOT NULL,
|
||||
IsRedeem VARCHAR(10) NOT NULL,
|
||||
IsSellback VARCHAR(10) NOT NULL,
|
||||
FirstProfit DECIMAL(10, 2) NULL,
|
||||
PRIMARY KEY (SecurityCode)
|
||||
);
|
||||
`
|
||||
@ -168,37 +101,9 @@ func AddBondData(data BondData) error {
|
||||
}
|
||||
defer tx.Rollback()
|
||||
query := `INSERT INTO BondData (
|
||||
SecurityCode, SecuCode, TradeMarket, SecurityNameAbbr, DelistDate,
|
||||
ListingDate, ConvertStockCode, BondExpire, Rating, ValueDate,
|
||||
IssueYear, CeaseDate, ExpireDate, PayInterestDay, InterestRateExplain,
|
||||
BondCombineCode, ActualIssueScale, IssuePrice, Remark, ParValue,
|
||||
IssueObject, RedeemType, ExecuteReasonHS, NoticeDateHS, NoticeDateSH,
|
||||
ExecutePriceHS, ExecutePriceSH, RecordDateSH, ExecuteStartDateSH, ExecuteStartDateHS,
|
||||
ExecuteEndDate, CorreCode, CorreCodeNameAbbr, PublicStartDate, CorreCodeO,
|
||||
CorreCodeNameAbbrO, BondStartDate, SecurityStartDate, SecurityShortName, FirstPerPreplacing,
|
||||
OnlineGeneralAAU, OnlineGeneralLWR, InitialTransferPrice, TransferEndDate, TransferStartDate,
|
||||
ResaleClause, RedeemClause, PartyName, ConvertStockPrice, TransferPrice,
|
||||
TransferValue, CurrentBondPrice, TransferPremiumRatio, ConvertStockPriceHQ, Market,
|
||||
ResaleTrigPrice, RedeemTrigPrice, PBVRatio, IBStartDate, IBEndDate,
|
||||
CashflowDate, CouponIR, ParamName, IssueType, ExecuteReasonSH,
|
||||
PaydayNew, CurrentBondPriceNew, IsConvertStock, IsRedeem, IsSellback,
|
||||
FirstProfit
|
||||
SecurityCode, SecuCode, TradeMarket, SecurityNameAbbr
|
||||
) VALUES (
|
||||
:SecurityCode, :SecuCode, :TradeMarket, :SecurityNameAbbr, :DelistDate,
|
||||
:ListingDate, :ConvertStockCode, :BondExpire, :Rating, :ValueDate,
|
||||
:IssueYear, :CeaseDate, :ExpireDate, :PayInterestDay, :InterestRateExplain,
|
||||
:BondCombineCode, :ActualIssueScale, :IssuePrice, :Remark, :ParValue,
|
||||
:IssueObject, :RedeemType, :ExecuteReasonHS, :NoticeDateHS, :NoticeDateSH,
|
||||
:ExecutePriceHS, :ExecutePriceSH, :RecordDateSH, :ExecuteStartDateSH, :ExecuteStartDateHS,
|
||||
:ExecuteEndDate, :CorreCode, :CorreCodeNameAbbr, :PublicStartDate, :CorreCodeO,
|
||||
:CorreCodeNameAbbrO, :BondStartDate, :SecurityStartDate, :SecurityShortName, :FirstPerPreplacing,
|
||||
:OnlineGeneralAAU, :OnlineGeneralLWR, :InitialTransferPrice, :TransferEndDate, :TransferStartDate,
|
||||
:ResaleClause, :RedeemClause, :PartyName, :ConvertStockPrice, :TransferPrice,
|
||||
:TransferValue, :CurrentBondPrice, :TransferPremiumRatio, :ConvertStockPriceHQ, :Market,
|
||||
:ResaleTrigPrice, :RedeemTrigPrice, :PBVRatio, :IBStartDate, :IBEndDate,
|
||||
:CashflowDate, :CouponIR, :ParamName, :IssueType, :ExecuteReasonSH,
|
||||
:PaydayNew, :CurrentBondPriceNew, :IsConvertStock, :IsRedeem, :IsSellback,
|
||||
:FirstProfit
|
||||
:SecurityCode, :SecuCode, :TradeMarket, :SecurityNameAbbr
|
||||
)`
|
||||
|
||||
_, err = tx.NamedExec(query, data)
|
||||
@ -246,7 +151,7 @@ func RoundCheckNewBond() {
|
||||
fmt.Println("Error checking bond data exists:", err)
|
||||
continue
|
||||
}
|
||||
if !exists && bond.ListingDate == nil {
|
||||
if !exists {
|
||||
for _, group := range groups {
|
||||
msg := model.Reply{
|
||||
ReplyMsg: fmt.Sprintf("号外号外,%s开始申购了", bond.SecurityNameAbbr),
|
||||
|
Loading…
x
Reference in New Issue
Block a user