Skip to content

Commit

Permalink
Snapshot volume is changed to float64 from int64. (#190)
Browse files Browse the repository at this point in the history
# Describe Request

Snapshot volume is changed to float64 from int64.

Fixed #157 

# Change Type

New feature.
  • Loading branch information
cinar authored Jul 20, 2024
1 parent 315cc88 commit c271eff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions asset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The information provided on this project is strictly for informational purposes
- [func SnapshotsAsHighs\(snapshots \<\-chan \*Snapshot\) \<\-chan float64](<#SnapshotsAsHighs>)
- [func SnapshotsAsLows\(snapshots \<\-chan \*Snapshot\) \<\-chan float64](<#SnapshotsAsLows>)
- [func SnapshotsAsOpenings\(snapshots \<\-chan \*Snapshot\) \<\-chan float64](<#SnapshotsAsOpenings>)
- [func SnapshotsAsVolumes\(snapshots \<\-chan \*Snapshot\) \<\-chan int64](<#SnapshotsAsVolumes>)
- [func SnapshotsAsVolumes\(snapshots \<\-chan \*Snapshot\) \<\-chan float64](<#SnapshotsAsVolumes>)
- [type FileSystemRepository](<#FileSystemRepository>)
- [func NewFileSystemRepository\(base string\) \*FileSystemRepository](<#NewFileSystemRepository>)
- [func \(r \*FileSystemRepository\) Append\(name string, snapshots \<\-chan \*Snapshot\) error](<#FileSystemRepository.Append>)
Expand Down Expand Up @@ -140,7 +140,7 @@ SnapshotsAsOpenings extracts the open field from each snapshot in the provided c
## func [SnapshotsAsVolumes](<https://github.com/cinar/indicator/blob/master/asset/snapshot.go#L88>)

```go
func SnapshotsAsVolumes(snapshots <-chan *Snapshot) <-chan int64
func SnapshotsAsVolumes(snapshots <-chan *Snapshot) <-chan float64
```

SnapshotsAsVolumes extracts the volume field from each snapshot in the provided channel and returns a new channel containing only those volume values.The original snapshots channel can no longer be directly used afterwards.
Expand Down Expand Up @@ -331,7 +331,7 @@ type Snapshot struct {

// Volume represents the total trading activity for
// the asset during the snapshot period.
Volume int64
Volume float64
}
```

Expand Down
6 changes: 3 additions & 3 deletions asset/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Snapshot struct {

// Volume represents the total trading activity for
// the asset during the snapshot period.
Volume int64
Volume float64
}

// SnapshotsAsDates extracts the date field from each snapshot in the provided
Expand Down Expand Up @@ -85,8 +85,8 @@ func SnapshotsAsClosings(snapshots <-chan *Snapshot) <-chan float64 {
// SnapshotsAsVolumes extracts the volume field from each snapshot in the provided
// channel and returns a new channel containing only those volume values.The
// original snapshots channel can no longer be directly used afterwards.
func SnapshotsAsVolumes(snapshots <-chan *Snapshot) <-chan int64 {
return helper.Map(snapshots, func(snapshot *Snapshot) int64 {
func SnapshotsAsVolumes(snapshots <-chan *Snapshot) <-chan float64 {
return helper.Map(snapshots, func(snapshot *Snapshot) float64 {
return snapshot.Volume
})
}
2 changes: 1 addition & 1 deletion asset/tiingo_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (e *TiingoEndOfDay) ToSnapshot() *Snapshot {
High: e.AdjHigh,
Low: e.AdjLow,
Close: e.AdjClose,
Volume: e.AdjVolume,
Volume: float64(e.AdjVolume),
}
}

Expand Down

0 comments on commit c271eff

Please sign in to comment.