Skip to content

Commit

Permalink
Merge pull request #7 from QuanTemplate/task/QUAN-8675-add-missing-mn…
Browse files Browse the repository at this point in the history
…emonics

Task/quan 8675 add missing mnemonic
  • Loading branch information
gbielskiqt authored May 11, 2021
2 parents 444f29e + 0587aa4 commit 848d7e8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ The diagram below describes a potential integration pattern where CapitalIQ data

- with yaml config:
```sh
java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar apply ./data/revReport.yml
java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar apply ./data/revReport.yml
```

Check out the [config file](./data/revReport.yml)


- with CLI args:
```sh
cat ./data/capitaliq-identifiers.txt | java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar generateRevenueReport --orgId c-my-small-insuranc-ltdzfd --datasetId d-e4tf3yyxerabcvicidv5oyey --currency USD --from 1988-12-31 --to 2018-12-31
cat ./data/capitaliq-identifiers.txt | java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar generateRevenueReport --orgId c-my-small-insuranc-ltdzfd --datasetId d-e4tf3yyxerabcvicidv5oyey --currency USD --from 1988-12-31 --to 2018-12-31
```

- Generating a multi-data point report for a single date with multiple Capital IQ mnemonics and uploading it to the Quantemplate dataset

- with yaml config:
```sh
java -jar ./capitaliq/target/scala-3.0.0-RC2/capitaliq-assembly-0.1.1.jar apply ./data/multiPointReport.yml
java -jar ./capitaliq/target/scala-3.0.0-RC2/qt-integrations-0.1.2.jar apply ./data/multiPointReport.yml
```

Check out the [config file](./data/multiPointReport.yml)
Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "api-integrations"

ThisBuild / organization := "com.quantemplate"
ThisBuild / scalaVersion := "3.0.0-RC2"
ThisBuild / version := "0.1.1"
ThisBuild / version := "0.1.2"

val AkkaVersion = "2.6.12"
val AkkaHttpVersion = "10.2.4"
Expand Down Expand Up @@ -45,6 +45,7 @@ lazy val capitaliq = (project in file("capitaliq"))
),

assembly / mainClass := Some("com.quantemplate.capitaliq.Main"),
assembly / assemblyJarName := s"qt-integrations-${version.value}.jar"
)

Compile / run / fork := true
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class MultiDataPointReport(capitalIqService: CapitalIQService, qtService: QTServ
case ColumnDef("IQ_ULT_PARENT", _) =>
IQ_ULT_PARENT.apply

case ColumnDef("IQ_ULT_PARENT_CIQID", _) =>
IQ_ULT_PARENT_CIQID.apply

case ColumnDef("IQ_COMPANY_ID", _) =>
id =>
IQ_COMPANY_ID(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import java.nio.file.Path
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import scala.concurrent.ExecutionContext
import scala.util.{Failure, Success}
import org.slf4j.LoggerFactory

import com.quantemplate.capitaliq.common.{Config, HttpService}
import com.quantemplate.capitaliq.domain.CapitalIQService
Expand All @@ -17,6 +19,8 @@ class MultiDataPointReportCmd:
private given system: ActorSystem[Nothing] = ActorSystem(Behaviors.empty, "capitaliq")
private given ExecutionContext = system.executionContext

private lazy val logger = LoggerFactory.getLogger(getClass)

private val httpService = HttpService()
private val qtService = QTService(httpService)
private val identifiersLoader = IdentifierLoader(qtService)
Expand All @@ -31,4 +35,17 @@ class MultiDataPointReportCmd:
.map(run)

private def run(config: CmdConfig) =
multiDataReport.generateSpreadSheet(config)
if config.identifiers.isEmpty then
logger.error("No valid CapitalIQ identifiers were provided. Aborting")
Runtime.getRuntime.halt(1)

multiDataReport
.generateSpreadSheet(config)
.onComplete {
case Failure(e) =>
logger.error("Failed to generate a multi data point report", e)
Runtime.getRuntime.halt(1)

case Success(_) =>
Runtime.getRuntime.halt(0)
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ object CapitalIQ:
( "GDSP", m.identifier.unwrap, "IQ_ULT_PARENT" )
}

case class IQ_ULT_PARENT_CIQID(identifier: Identifier) extends Mnemonic:
def name = productPrefix
object IQ_ULT_PARENT_CIQID:
given Encoder[IQ_ULT_PARENT_CIQID] =
Encoder.forProduct3("function", "identifier", "mnemonic") { m =>
( "GDSP", m.identifier.unwrap, "IQ_ULT_PARENT_CIQID" )
}

case class IQ_COMPANY_ID(properties: IQ_COMPANY_ID.Fn, identifier: Identifier) extends Mnemonic:
def name = productPrefix
object IQ_COMPANY_ID:
Expand Down Expand Up @@ -1418,6 +1426,7 @@ object CapitalIQ:
case m: IQ_COMPANY_NAME_LONG => m.asJson
case m: IQ_COMPANY_ID => m.asJson
case m: IQ_ULT_PARENT => m.asJson
case m: IQ_ULT_PARENT_CIQID => m.asJson
case m: IQ_MARKETCAP => m.asJson
case m: IQ_NI => m.asJson
case m: IQ_TOTAL_EMPLOYEES => m.asJson
Expand Down
4 changes: 2 additions & 2 deletions data/multiPointReport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ params:
date: 2021-05-05
identifiers:
distinct: true
limit: 30
limit: 9
dataset:
datasetId: d-vvgqdpct2jh3ys3c4iuncyjh
columnName: Company ID
columns: # Capital IQ mnemonics used for the columns construction
- IQ_COMPANY_NAME_LONG
- IQ_COMPANY_ID
- IQ_ULT_PARENT
- IQ_ULT_PARENT_CIQID
- IQ_TOTAL_REV
- IQ_MARKETCAP
- IQ_NI
- IQ_EBITDA
- IQ_TOTAL_EMPLOYEES

0 comments on commit 848d7e8

Please sign in to comment.