Skip to content
This repository has been archived by the owner on Jul 4, 2020. It is now read-only.

Commit

Permalink
Moved models outside internal
Browse files Browse the repository at this point in the history
  • Loading branch information
almeida-raphael committed Jun 21, 2020
1 parent cdf571b commit 46e796d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion pkg/b3/get_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package b3

import (
"github.com/Bezunca/B3History/pkg/http"
"github.com/Bezunca/B3History/pkg/internal/models"
"github.com/Bezunca/B3History/pkg/internal/parser"
"github.com/Bezunca/B3History/pkg/models"
"github.com/Bezunca/ZipInMemory/pkg/zip"
)

Expand Down
35 changes: 0 additions & 35 deletions pkg/internal/models/asset.go

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/internal/parser/history_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/Bezunca/B3History/pkg/internal/models"
"github.com/Bezunca/B3History/pkg/models"
)

func parseContentLine(rawLine string, year int) (*models.AssetInfo, error) {
Expand Down Expand Up @@ -90,7 +90,7 @@ func parseContentLine(rawLine string, year int) (*models.AssetInfo, error) {
return nil, err
}
return &models.AssetInfo{
Year: year,
Year: year,
TipReg: int(tipReg),
DataCollectionDate: date,
BDICode: int(bdiCode),
Expand Down
35 changes: 35 additions & 0 deletions pkg/models/asset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package models

import "time"

type FixedPoint int // Represents the actual value multiplied by 100

type AssetInfo struct {
Year int `json:"year" bson:"year"`
TipReg int `json:"-" bson:"-" `
DataCollectionDate time.Time `json:"data" bson:"data"`
BDICode int `json:"-" bson:"-"`
Ticker string `json:"ticker" bson:"ticker"`
MarketType int `json:"market_type" bson:"market_type"`
CompanyName string `json:"shot_company_name" bson:"shot_company_name"`
SecurityType string `json:"security_type" bson:"security_type"`
FutureMarketExpiration string `json:" future_market_expiration" bson:" future_market_expiration"` // Need to check this against an example that actually has a value
Currency string `json:"currency" bson:"currency"`
PriceOpen FixedPoint `json:"-" bson:"-"`
PriceMax FixedPoint `json:"-" bson:"-"`
PriceMin FixedPoint `json:"-" bson:"-"`
PriceMean FixedPoint `json:"-" bson:"-"`
PriceClose FixedPoint `json:"price_close" bson:"price_close"`
PriceBid FixedPoint `json:"-" bson:"-"`
PriceAsk FixedPoint `json:"-" bson:"-"`
TotalTrades int `json:"-" bson:"-"`
TotalQuantity int `json:"-" bson:"-"`
TotalVolume FixedPoint `json:"total_volume" bson:"total_volume"`
PreExe FixedPoint `json:"execution_price" bson:"execution_price"` // Needs further investigation
IndOpc int `json:"-" bson:"-"` // Needs further investigation
ExpirationDate time.Time `json:"expiration_date" bson:"expiration_date"`
FatCot int `json:"-" bson:"-"` // Needs further investigation
PtoExe int `json:"-" bson:"-"` // Needs further investigation
ISINCode string `json:"-" bson:"-"`
DistributionNumber int `json:"-" bson:"-"`
}

0 comments on commit 46e796d

Please sign in to comment.