refactor: remove unused fields from BondData struct and update database schema for improved clarity and maintainability
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user