Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weighted averages report to web ver #266

16 changes: 2 additions & 14 deletions workers/loc.api/di/app.deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ const CurrencyConverter = require('../sync/currency.converter')
const CsvJobData = require('../generate-csv/csv.job.data')
const {
fullSnapshotReportCsvWriter,
fullTaxReportCsvWriter,
weightedAveragesReportCsvWriter
fullTaxReportCsvWriter
} = require('../generate-csv/csv-writer')
const FullTaxReport = require('../sync/full.tax.report')
const WeightedAveragesReport = require('../sync/weighted.averages.report')
Expand Down Expand Up @@ -157,7 +156,6 @@ module.exports = ({
['_syncCollsManager', TYPES.SyncCollsManager],
['_dataConsistencyChecker', TYPES.DataConsistencyChecker],
['_winLossVSAccountBalance', TYPES.WinLossVSAccountBalance],
['_weightedAveragesReport', TYPES.WeightedAveragesReport],
['_getDataFromApi', TYPES.GetDataFromApi],
['_httpRequest', TYPES.HTTPRequest]
]
Expand Down Expand Up @@ -381,19 +379,9 @@ module.exports = ({
]
)
)
bind(TYPES.WeightedAveragesReportCsvWriter)
.toConstantValue(
bindDepsToFn(
weightedAveragesReportCsvWriter,
[
TYPES.RService,
TYPES.GetDataFromApi
]
)
)
bind(TYPES.FullTaxReport)
.to(FullTaxReport)
bind(TYPES.WeightedAveragesReport)
rebind(TYPES.WeightedAveragesReport)
.to(WeightedAveragesReport)
rebind(TYPES.CsvJobData)
.to(CsvJobData)
Expand Down
2 changes: 0 additions & 2 deletions workers/loc.api/di/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,5 @@ module.exports = {
SyncUserStepManager: Symbol.for('SyncUserStepManager'),
SyncUserStepData: Symbol.for('SyncUserStepData'),
SyncUserStepDataFactory: Symbol.for('SyncUserStepDataFactory'),
WeightedAveragesReport: Symbol.for('WeightedAveragesReport'),
WeightedAveragesReportCsvWriter: Symbol.for('WeightedAveragesReportCsvWriter'),
HTTPRequest: Symbol.for('HTTPRequest')
}
6 changes: 1 addition & 5 deletions workers/loc.api/generate-csv/csv-writer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ const fullSnapshotReportCsvWriter = require(
const fullTaxReportCsvWriter = require(
'./full-tax-report-csv-writer'
)
const weightedAveragesReportCsvWriter = require(
'./weighted-averages-report-csv-writer'
)

module.exports = {
fullSnapshotReportCsvWriter,
fullTaxReportCsvWriter,
weightedAveragesReportCsvWriter
fullTaxReportCsvWriter
}

This file was deleted.

42 changes: 0 additions & 42 deletions workers/loc.api/generate-csv/csv.job.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,48 +670,6 @@ class CsvJobData extends BaseCsvJobData {

return jobData
}

async getWeightedAveragesReportCsvJobData (
args,
uId,
uInfo
) {
checkParams(args, 'paramsSchemaForWeightedAveragesReportApiCsv')

const {
userId,
userInfo
} = await checkJobAndGetUserData(
this.rService,
uId,
uInfo
)

const csvArgs = getCsvArgs(args)

const jobData = {
userInfo,
userId,
name: 'getWeightedAveragesReport',
fileNamesMap: [['getWeightedAveragesReport', 'weighted-averages-report']],
args: csvArgs,
columnsCsv: {
symbol: 'PAIR',
buyingWeightedPrice: 'WEIGHTED PRICE',
buyingAmount: 'AMOUNT',
sellingWeightedPrice: 'WEIGHTED PRICE',
sellingAmount: 'AMOUNT',
cumulativeWeightedPrice: 'WEIGHTED PRICE',
cumulativeAmount: 'AMOUNT'
},
formatSettings: {
symbol: 'symbol'
},
csvCustomWriter: this.weightedAveragesReportCsvWriter
}

return jobData
}
}

decorateInjectable(CsvJobData, depsTypes)
Expand Down
26 changes: 0 additions & 26 deletions workers/loc.api/helpers/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,6 @@ const paramsSchemaForWinLossVSAccountBalanceApi = {
}
}

const paramsSchemaForWeightedAveragesReportApi = {
type: 'object',
properties: {
start: {
type: 'integer'
},
end: {
type: 'integer'
},
symbol: {
type: ['string', 'array']
}
}
}

const paramsSchemaForTradedVolumeApi = {
type: 'object',
properties: {
Expand Down Expand Up @@ -384,15 +369,6 @@ const paramsSchemaForWinLossVSAccountBalanceCsv = {
}
}

const paramsSchemaForWeightedAveragesReportApiCsv = {
type: 'object',
properties: {
...cloneDeep(paramsSchemaForWeightedAveragesReportApi.properties),
timezone,
dateFormat
}
}

const paramsSchemaForPositionsSnapshotCsv = {
type: 'object',
properties: {
Expand Down Expand Up @@ -469,7 +445,6 @@ module.exports = {
paramsSchemaForBalanceHistoryApi,
paramsSchemaForWinLossApi,
paramsSchemaForWinLossVSAccountBalanceApi,
paramsSchemaForWeightedAveragesReportApi,
paramsSchemaForPositionsSnapshotApi,
paramsSchemaForFullSnapshotReportApi,
paramsSchemaForFullTaxReportApi,
Expand All @@ -480,7 +455,6 @@ module.exports = {
paramsSchemaForBalanceHistoryCsv,
paramsSchemaForWinLossCsv,
paramsSchemaForWinLossVSAccountBalanceCsv,
paramsSchemaForWeightedAveragesReportApiCsv,
paramsSchemaForPositionsSnapshotCsv,
paramsSchemaForFullSnapshotReportCsv,
paramsSchemaForFullTaxReportCsv,
Expand Down
18 changes: 0 additions & 18 deletions workers/loc.api/service.report.framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -1378,15 +1378,6 @@ class FrameworkReportService extends ReportService {
}, 'getWinLossVSAccountBalance', args, cb)
}

getWeightedAveragesReport (space, args, cb) {
return this._privResponder(async () => {
checkParams(args, 'paramsSchemaForWeightedAveragesReportApi')

return this._weightedAveragesReport
.getWeightedAveragesReport(args)
}, 'getWeightedAveragesReport', args, cb)
}

/**
* @override
*/
Expand Down Expand Up @@ -1491,15 +1482,6 @@ class FrameworkReportService extends ReportService {
)
}, 'getWinLossVSAccountBalanceCsv', args, cb)
}

getWeightedAveragesReportCsv (space, args, cb) {
return this._responder(() => {
return this._generateCsv(
'getWeightedAveragesReportCsvJobData',
args
)
}, 'getWeightedAveragesReportCsv', args, cb)
}
}

module.exports = FrameworkReportService
Loading