Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
e68ebdf76d | |||
949cf58eef | |||
0816defb95 | |||
a076a1c933 | |||
40c95a541d | |||
2d04d7b8d5 | |||
94e0feac68 | |||
cd9e974c40 |
23
CHANGELOG.md
23
CHANGELOG.md
@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 0.96.0 - 30.04.2021
|
||||
|
||||
### Added
|
||||
|
||||
- Added the absolute change to the position detail dialog
|
||||
- Added the number of transactions to the position detail dialog
|
||||
|
||||
### Changed
|
||||
|
||||
- Harmonized the slogan to "Open Source Portfolio Tracker"
|
||||
|
||||
## 0.95.0 - 28.04.2021
|
||||
|
||||
### Added
|
||||
|
||||
- Added a data source attribute to the transactions model
|
||||
|
||||
## 0.94.0 - 27.04.2021
|
||||
|
||||
### Added
|
||||
|
||||
- Added the generic scraper symbols to the symbol lookup results
|
||||
|
||||
## 0.93.0 - 26.04.2021
|
||||
|
||||
### Changed
|
||||
|
@ -39,6 +39,7 @@ export class ExperimentalService {
|
||||
accountId: undefined,
|
||||
accountUserId: undefined,
|
||||
createdAt: new Date(),
|
||||
dataSource: undefined,
|
||||
date: parseISO(order.date),
|
||||
fee: 0,
|
||||
id: undefined,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Currency, Type } from '@prisma/client';
|
||||
import { Currency, DataSource, Type } from '@prisma/client';
|
||||
import { IsISO8601, IsNumber, IsString, ValidateIf } from 'class-validator';
|
||||
|
||||
export class CreateOrderDto {
|
||||
@ -8,6 +8,9 @@ export class CreateOrderDto {
|
||||
@IsString()
|
||||
currency: Currency;
|
||||
|
||||
@IsString()
|
||||
dataSource: DataSource;
|
||||
|
||||
@IsISO8601()
|
||||
date: string;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Currency, Type } from '@prisma/client';
|
||||
import { Currency, DataSource, Type } from '@prisma/client';
|
||||
import { IsISO8601, IsNumber, IsString, ValidateIf } from 'class-validator';
|
||||
|
||||
export class UpdateOrderDto {
|
||||
@ -8,6 +8,9 @@ export class UpdateOrderDto {
|
||||
@IsString()
|
||||
currency: Currency;
|
||||
|
||||
@IsString()
|
||||
dataSource: DataSource;
|
||||
|
||||
@IsISO8601()
|
||||
date: string;
|
||||
|
||||
|
@ -16,4 +16,5 @@ export interface Position {
|
||||
investmentInOriginalCurrency?: number;
|
||||
marketPrice?: number;
|
||||
quantity: number;
|
||||
transactionCount: number;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { Currency } from '@prisma/client';
|
||||
|
||||
export interface PortfolioPositionDetail {
|
||||
averagePrice: number;
|
||||
currency: string;
|
||||
currency: Currency;
|
||||
firstBuyDate: string;
|
||||
grossPerformance: number;
|
||||
grossPerformancePercent: number;
|
||||
@ -11,6 +13,7 @@ export interface PortfolioPositionDetail {
|
||||
minPrice: number;
|
||||
quantity: number;
|
||||
symbol: string;
|
||||
transactionCount: number;
|
||||
}
|
||||
|
||||
export interface HistoricalDataItem {
|
||||
|
@ -20,6 +20,7 @@ export interface PortfolioPosition {
|
||||
sector?: string;
|
||||
shareCurrent: number;
|
||||
shareInvestment: number;
|
||||
transactionCount: number;
|
||||
symbol: string;
|
||||
type?: string;
|
||||
url?: string;
|
||||
|
@ -209,7 +209,8 @@ export class PortfolioService {
|
||||
firstBuyDate,
|
||||
investment,
|
||||
marketPrice,
|
||||
quantity
|
||||
quantity,
|
||||
transactionCount
|
||||
} = portfolio.getPositions(new Date())[aSymbol];
|
||||
|
||||
const historicalData = await this.dataProviderService.getHistorical(
|
||||
@ -262,6 +263,7 @@ export class PortfolioService {
|
||||
maxPrice,
|
||||
minPrice,
|
||||
quantity,
|
||||
transactionCount,
|
||||
grossPerformance: this.exchangeRateDataService.toCurrency(
|
||||
marketPrice - averagePrice,
|
||||
currency,
|
||||
@ -315,7 +317,8 @@ export class PortfolioService {
|
||||
maxPrice: undefined,
|
||||
minPrice: undefined,
|
||||
quantity: undefined,
|
||||
symbol: aSymbol
|
||||
symbol: aSymbol,
|
||||
transactionCount: undefined
|
||||
};
|
||||
}
|
||||
|
||||
@ -331,7 +334,8 @@ export class PortfolioService {
|
||||
maxPrice: undefined,
|
||||
minPrice: undefined,
|
||||
quantity: undefined,
|
||||
symbol: aSymbol
|
||||
symbol: aSymbol,
|
||||
transactionCount: undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Currency } from '@prisma/client';
|
||||
import { Currency, DataSource } from '@prisma/client';
|
||||
|
||||
export interface SymbolItem {
|
||||
currency: Currency;
|
||||
dataSource: DataSource;
|
||||
marketPrice: number;
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service';
|
||||
import { DataProviderService } from '@ghostfolio/api/services/data-provider.service';
|
||||
import { GhostfolioScraperApiService } from '@ghostfolio/api/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service';
|
||||
import { convertFromYahooSymbol } from '@ghostfolio/api/services/data-provider/yahoo-finance/yahoo-finance.service';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Currency } from '@prisma/client';
|
||||
@ -10,31 +12,51 @@ import { SymbolItem } from './interfaces/symbol-item.interface';
|
||||
@Injectable()
|
||||
export class SymbolService {
|
||||
public constructor(
|
||||
private readonly dataProviderService: DataProviderService
|
||||
private readonly dataProviderService: DataProviderService,
|
||||
private readonly ghostfolioScraperApiService: GhostfolioScraperApiService
|
||||
) {}
|
||||
|
||||
public async get(aSymbol: string): Promise<SymbolItem> {
|
||||
const response = await this.dataProviderService.get([aSymbol]);
|
||||
const { currency, marketPrice } = response[aSymbol];
|
||||
const { currency, dataSource, marketPrice } = response[aSymbol];
|
||||
|
||||
return {
|
||||
dataSource,
|
||||
marketPrice,
|
||||
currency: <Currency>(<unknown>currency)
|
||||
};
|
||||
}
|
||||
|
||||
public async lookup(aQuery: string): Promise<LookupItem[]> {
|
||||
public async lookup(aQuery = ''): Promise<LookupItem[]> {
|
||||
const query = aQuery.toLowerCase();
|
||||
const results: LookupItem[] = [];
|
||||
|
||||
if (!query) {
|
||||
return results;
|
||||
}
|
||||
|
||||
const get = bent(
|
||||
`https://query1.finance.yahoo.com/v1/finance/search?q=${aQuery}&lang=en-US®ion=US"esCount=8&newsCount=0&enableFuzzyQuery=false"esQueryId=tss_match_phrase_query&multiQuoteQueryId=multi_quote_single_token_query&newsQueryId=news_cie_vespa&enableCb=true&enableNavLinks=false&enableEnhancedTrivialQuery=true`,
|
||||
`https://query1.finance.yahoo.com/v1/finance/search?q=${query}&lang=en-US®ion=US"esCount=8&newsCount=0&enableFuzzyQuery=false"esQueryId=tss_match_phrase_query&multiQuoteQueryId=multi_quote_single_token_query&newsQueryId=news_cie_vespa&enableCb=true&enableNavLinks=false&enableEnhancedTrivialQuery=true`,
|
||||
'GET',
|
||||
'json',
|
||||
200
|
||||
);
|
||||
|
||||
// Add custom symbols
|
||||
const scraperConfigurations = await this.ghostfolioScraperApiService.getScraperConfigurations();
|
||||
scraperConfigurations.forEach((scraperConfiguration) => {
|
||||
if (scraperConfiguration.name.toLowerCase().startsWith(query)) {
|
||||
results.push({
|
||||
name: scraperConfiguration.name,
|
||||
symbol: scraperConfiguration.symbol
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const { quotes } = await get();
|
||||
|
||||
return quotes
|
||||
const searchResult = quotes
|
||||
.filter(({ isYahooFinance }) => {
|
||||
return isYahooFinance;
|
||||
})
|
||||
@ -59,6 +81,8 @@ export class SymbolService {
|
||||
symbol: convertFromYahooSymbol(symbol)
|
||||
};
|
||||
});
|
||||
|
||||
return results.concat(searchResult);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
|
@ -57,7 +57,7 @@ export class Portfolio implements PortfolioInterface {
|
||||
public async addCurrentPortfolioItems() {
|
||||
const currentData = await this.dataProviderService.get(this.getSymbols());
|
||||
|
||||
let currentDate = new Date();
|
||||
const currentDate = new Date();
|
||||
|
||||
const year = getYear(currentDate);
|
||||
const month = getMonth(currentDate);
|
||||
@ -82,7 +82,9 @@ export class Portfolio implements PortfolioInterface {
|
||||
marketPrice:
|
||||
currentData[symbol]?.marketPrice ??
|
||||
portfolioItemsYesterday.positions[symbol]?.marketPrice,
|
||||
quantity: portfolioItemsYesterday?.positions[symbol]?.quantity
|
||||
quantity: portfolioItemsYesterday?.positions[symbol]?.quantity,
|
||||
transactionCount:
|
||||
portfolioItemsYesterday?.positions[symbol]?.transactionCount
|
||||
};
|
||||
});
|
||||
|
||||
@ -289,7 +291,9 @@ export class Portfolio implements PortfolioInterface {
|
||||
data[symbol]?.currency,
|
||||
this.user.Settings.currency
|
||||
) / value,
|
||||
shareInvestment: portfolioItem.positions[symbol].investment / investment
|
||||
shareInvestment:
|
||||
portfolioItem.positions[symbol].investment / investment,
|
||||
transactionCount: portfolioItem.positions[symbol].transactionCount
|
||||
};
|
||||
});
|
||||
|
||||
@ -582,7 +586,8 @@ export class Portfolio implements PortfolioInterface {
|
||||
marketPrice:
|
||||
historicalData[symbol]?.[format(currentDate, 'yyyy-MM-dd')]
|
||||
?.marketPrice || 0,
|
||||
quantity: 0
|
||||
quantity: 0,
|
||||
transactionCount: 0
|
||||
};
|
||||
});
|
||||
|
||||
@ -623,7 +628,8 @@ export class Portfolio implements PortfolioInterface {
|
||||
marketPrice:
|
||||
historicalData[symbol]?.[format(yesterday, 'yyyy-MM-dd')]
|
||||
?.marketPrice || 0,
|
||||
quantity: 0
|
||||
quantity: 0,
|
||||
transactionCount: 0
|
||||
};
|
||||
});
|
||||
|
||||
@ -730,6 +736,10 @@ export class Portfolio implements PortfolioInterface {
|
||||
order.getSymbol()
|
||||
].currency = order.getCurrency();
|
||||
|
||||
this.portfolioItems[i].positions[
|
||||
order.getSymbol()
|
||||
].transactionCount += 1;
|
||||
|
||||
if (order.getType() === 'BUY') {
|
||||
if (
|
||||
!this.portfolioItems[i].positions[order.getSymbol()].firstBuyDate
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
|
||||
import { ConfigurationService } from './configuration.service';
|
||||
import { DataProviderService } from './data-provider.service';
|
||||
import { GhostfolioScraperApiService } from './data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service';
|
||||
import { PrismaService } from './prisma.service';
|
||||
|
||||
@Injectable()
|
||||
@ -25,6 +26,7 @@ export class DataGatheringService {
|
||||
public constructor(
|
||||
private readonly configurationService: ConfigurationService,
|
||||
private readonly dataProviderService: DataProviderService,
|
||||
private readonly ghostfolioScraperApi: GhostfolioScraperApiService,
|
||||
private prisma: PrismaService
|
||||
) {}
|
||||
|
||||
@ -183,6 +185,17 @@ export class DataGatheringService {
|
||||
}
|
||||
}
|
||||
|
||||
public async getCustomSymbolsToGather(startDate?: Date) {
|
||||
const scraperConfigurations = await this.ghostfolioScraperApi.getScraperConfigurations();
|
||||
|
||||
return scraperConfigurations.map((scraperConfiguration) => {
|
||||
return {
|
||||
date: startDate,
|
||||
symbol: scraperConfiguration.symbol
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private getBenchmarksToGather(startDate: Date) {
|
||||
const benchmarksToGather = benchmarks.map((symbol) => {
|
||||
return {
|
||||
@ -201,32 +214,6 @@ export class DataGatheringService {
|
||||
return benchmarksToGather;
|
||||
}
|
||||
|
||||
private async getCustomSymbolsToGather(startDate: Date) {
|
||||
const customSymbolsToGather = [];
|
||||
|
||||
if (this.configurationService.get('ENABLE_FEATURE_CUSTOM_SYMBOLS')) {
|
||||
try {
|
||||
const {
|
||||
value: scraperConfigString
|
||||
} = await this.prisma.property.findFirst({
|
||||
select: {
|
||||
value: true
|
||||
},
|
||||
where: { key: 'SCRAPER_CONFIG' }
|
||||
});
|
||||
|
||||
JSON.parse(scraperConfigString).forEach((item) => {
|
||||
customSymbolsToGather.push({
|
||||
date: startDate,
|
||||
symbol: item.symbol
|
||||
});
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return customSymbolsToGather;
|
||||
}
|
||||
|
||||
private async getSymbols7D(): Promise<{ date: Date; symbol: string }[]> {
|
||||
const startDate = subDays(resetHours(new Date()), 7);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { DataSource } from '.prisma/client';
|
||||
import { getYesterday } from '@ghostfolio/helper';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import * as bent from 'bent';
|
||||
@ -12,6 +13,7 @@ import {
|
||||
MarketState
|
||||
} from '../../interfaces/interfaces';
|
||||
import { PrismaService } from '../../prisma.service';
|
||||
import { ScraperConfig } from './interfaces/scraper-config.interface';
|
||||
|
||||
@Injectable()
|
||||
export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
@ -29,7 +31,7 @@ export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
try {
|
||||
const symbol = aSymbols[0];
|
||||
|
||||
const scraperConfig = await this.getScraperConfig(symbol);
|
||||
const scraperConfig = await this.getScraperConfigurationBySymbol(symbol);
|
||||
|
||||
const { marketPrice } = await this.prisma.marketData.findFirst({
|
||||
orderBy: {
|
||||
@ -44,6 +46,7 @@ export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
[symbol]: {
|
||||
marketPrice,
|
||||
currency: scraperConfig?.currency,
|
||||
dataSource: DataSource.GHOSTFOLIO,
|
||||
marketState: MarketState.delayed,
|
||||
name: scraperConfig?.name
|
||||
}
|
||||
@ -70,15 +73,17 @@ export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
try {
|
||||
const symbol = aSymbols[0];
|
||||
|
||||
const scraperConfig = await this.getScraperConfig(symbol);
|
||||
const scraperConfiguration = await this.getScraperConfigurationBySymbol(
|
||||
symbol
|
||||
);
|
||||
|
||||
const get = bent(scraperConfig?.url, 'GET', 'string', 200, {});
|
||||
const get = bent(scraperConfiguration?.url, 'GET', 'string', 200, {});
|
||||
|
||||
const html = await get();
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
const value = this.extractNumberFromString(
|
||||
$(scraperConfig?.selector).text()
|
||||
$(scraperConfiguration?.selector).text()
|
||||
);
|
||||
|
||||
return {
|
||||
@ -95,6 +100,23 @@ export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
return {};
|
||||
}
|
||||
|
||||
public async getScraperConfigurations(): Promise<ScraperConfig[]> {
|
||||
try {
|
||||
const {
|
||||
value: scraperConfigString
|
||||
} = await this.prisma.property.findFirst({
|
||||
select: {
|
||||
value: true
|
||||
},
|
||||
where: { key: 'SCRAPER_CONFIG' }
|
||||
});
|
||||
|
||||
return JSON.parse(scraperConfigString);
|
||||
} catch {}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
private extractNumberFromString(aString: string): number {
|
||||
try {
|
||||
const [numberString] = aString.match(
|
||||
@ -106,22 +128,10 @@ export class GhostfolioScraperApiService implements DataProviderInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private async getScraperConfig(aSymbol: string) {
|
||||
try {
|
||||
const {
|
||||
value: scraperConfigString
|
||||
} = await this.prisma.property.findFirst({
|
||||
select: {
|
||||
value: true
|
||||
},
|
||||
where: { key: 'SCRAPER_CONFIG' }
|
||||
});
|
||||
|
||||
return JSON.parse(scraperConfigString).find((item) => {
|
||||
return item.symbol === aSymbol;
|
||||
});
|
||||
} catch {}
|
||||
|
||||
return {};
|
||||
private async getScraperConfigurationBySymbol(aSymbol: string) {
|
||||
const scraperConfigurations = await this.getScraperConfigurations();
|
||||
return scraperConfigurations.find((scraperConfiguration) => {
|
||||
return scraperConfiguration.symbol === aSymbol;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
import { Currency } from '.prisma/client';
|
||||
|
||||
export interface ScraperConfig {
|
||||
currency: Currency;
|
||||
name: string;
|
||||
selector: string;
|
||||
symbol: string;
|
||||
url: string;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { DataSource } from '.prisma/client';
|
||||
import { getToday, getYesterday } from '@ghostfolio/helper';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import * as bent from 'bent';
|
||||
@ -39,6 +40,7 @@ export class RakutenRapidApiService implements DataProviderInterface {
|
||||
return {
|
||||
'GF.FEAR_AND_GREED_INDEX': {
|
||||
currency: undefined,
|
||||
dataSource: DataSource.RAKUTEN,
|
||||
marketPrice: fgi.now.value,
|
||||
marketState: MarketState.open,
|
||||
name: RakutenRapidApiService.FEAR_AND_GREED_INDEX_NAME
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { DataSource } from '.prisma/client';
|
||||
import { isCrypto, isCurrency, parseCurrency } from '@ghostfolio/helper';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { format } from 'date-fns';
|
||||
@ -49,6 +50,7 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
|
||||
response[symbol] = {
|
||||
currency: parseCurrency(value.price?.currency),
|
||||
dataSource: DataSource.YAHOO,
|
||||
exchange: this.parseExchange(value.price?.exchangeName),
|
||||
marketState:
|
||||
value.price?.marketState === 'REGULAR' || isCrypto(symbol)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Currency, Platform } from '@prisma/client';
|
||||
import { Currency, DataSource, Platform } from '@prisma/client';
|
||||
|
||||
import { OrderType } from '../../models/order-type';
|
||||
|
||||
@ -51,6 +51,7 @@ export interface IDataProviderHistoricalResponse {
|
||||
|
||||
export interface IDataProviderResponse {
|
||||
currency: Currency;
|
||||
dataSource: DataSource;
|
||||
exchange?: string;
|
||||
industry?: Industry;
|
||||
marketChange?: number;
|
||||
|
@ -23,6 +23,7 @@ export class PositionDetailDialog {
|
||||
public benchmarkDataItems: LineChartItem[];
|
||||
public currency: string;
|
||||
public firstBuyDate: string;
|
||||
public grossPerformance: number;
|
||||
public grossPerformancePercent: number;
|
||||
public historicalDataItems: LineChartItem[];
|
||||
public investment: number;
|
||||
@ -30,6 +31,7 @@ export class PositionDetailDialog {
|
||||
public maxPrice: number;
|
||||
public minPrice: number;
|
||||
public quantity: number;
|
||||
public transactionCount: number;
|
||||
|
||||
public constructor(
|
||||
private cd: ChangeDetectorRef,
|
||||
@ -44,18 +46,21 @@ export class PositionDetailDialog {
|
||||
averagePrice,
|
||||
currency,
|
||||
firstBuyDate,
|
||||
grossPerformance,
|
||||
grossPerformancePercent,
|
||||
historicalData,
|
||||
investment,
|
||||
marketPrice,
|
||||
maxPrice,
|
||||
minPrice,
|
||||
quantity
|
||||
quantity,
|
||||
transactionCount
|
||||
}) => {
|
||||
this.averagePrice = averagePrice;
|
||||
this.benchmarkDataItems = [];
|
||||
this.currency = currency;
|
||||
this.firstBuyDate = firstBuyDate;
|
||||
this.grossPerformance = quantity * grossPerformance;
|
||||
this.grossPerformancePercent = grossPerformancePercent;
|
||||
this.historicalDataItems = historicalData.map(
|
||||
(historicalDataItem) => {
|
||||
@ -75,6 +80,7 @@ export class PositionDetailDialog {
|
||||
this.maxPrice = maxPrice;
|
||||
this.minPrice = minPrice;
|
||||
this.quantity = quantity;
|
||||
this.transactionCount = transactionCount;
|
||||
|
||||
if (isToday(parseISO(this.firstBuyDate))) {
|
||||
// Add average price
|
||||
|
@ -19,6 +19,16 @@
|
||||
></gf-line-chart>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="Change"
|
||||
size="medium"
|
||||
[colorizeSign]="true"
|
||||
[currency]="data.baseCurrency"
|
||||
[locale]="data.locale"
|
||||
[value]="grossPerformance"
|
||||
></gf-value>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="Performance"
|
||||
@ -29,13 +39,6 @@
|
||||
[value]="grossPerformancePercent"
|
||||
></gf-value>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="First Buy Date"
|
||||
size="medium"
|
||||
[value]="firstBuyDate"
|
||||
></gf-value>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="Ø Buy Price"
|
||||
@ -91,6 +94,22 @@
|
||||
[value]="investment"
|
||||
></gf-value>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="First Buy Date"
|
||||
size="medium"
|
||||
[value]="firstBuyDate"
|
||||
></gf-value>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="Transactions"
|
||||
size="medium"
|
||||
[isCurrency]="true"
|
||||
[locale]="data.locale"
|
||||
[value]="transactionCount"
|
||||
></gf-value>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -78,8 +78,9 @@ export class CreateOrUpdateTransactionDialog {
|
||||
this.dataService
|
||||
.fetchSymbolItem(this.data.transaction.symbol)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(({ currency, marketPrice }) => {
|
||||
.subscribe(({ currency, dataSource, marketPrice }) => {
|
||||
this.data.transaction.currency = currency;
|
||||
this.data.transaction.dataSource = dataSource;
|
||||
this.data.transaction.unitPrice = marketPrice;
|
||||
|
||||
this.isLoading = false;
|
||||
@ -90,6 +91,7 @@ export class CreateOrUpdateTransactionDialog {
|
||||
|
||||
public onUpdateSymbolByTyping(value: string) {
|
||||
this.data.transaction.currency = null;
|
||||
this.data.transaction.dataSource = null;
|
||||
this.data.transaction.unitPrice = null;
|
||||
|
||||
this.data.transaction.symbol = value;
|
||||
|
@ -25,7 +25,7 @@
|
||||
class="autocomplete"
|
||||
[value]="lookupItem.symbol"
|
||||
>
|
||||
<span class="mr-2 symbol">{{ lookupItem.symbol }}</span
|
||||
<span class="mr-2 symbol">{{ lookupItem.symbol | gfSymbol }}</span
|
||||
><span><b>{{ lookupItem.name }}</b></span>
|
||||
</mat-option>
|
||||
</ng-container>
|
||||
@ -58,6 +58,18 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="d-none">
|
||||
<mat-form-field appearance="outline" class="w-100">
|
||||
<mat-label i18n>Data Source</mat-label>
|
||||
<input
|
||||
disabled
|
||||
matInput
|
||||
name="dataSource"
|
||||
required
|
||||
[(ngModel)]="data.transaction.dataSource"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field appearance="outline" class="w-100">
|
||||
<mat-label i18n>Date</mat-label>
|
||||
@ -113,6 +125,7 @@
|
||||
<mat-form-field appearance="outline" class="w-100">
|
||||
<mat-label i18n>Account</mat-label>
|
||||
<mat-select
|
||||
disabled
|
||||
name="accountId"
|
||||
required
|
||||
[(value)]="data.transaction.accountId"
|
||||
|
@ -9,6 +9,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module';
|
||||
|
||||
import { CreateOrUpdateTransactionDialog } from './create-or-update-transaction-dialog.component';
|
||||
|
||||
@ -17,6 +18,7 @@ import { CreateOrUpdateTransactionDialog } from './create-or-update-transaction-
|
||||
exports: [],
|
||||
imports: [
|
||||
CommonModule,
|
||||
GfSymbolModule,
|
||||
FormsModule,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Order } from '../../interfaces/order.interface';
|
||||
import { Account } from '@prisma/client';
|
||||
|
||||
import { Order } from '../../interfaces/order.interface';
|
||||
|
||||
export interface CreateOrUpdateTransactionDialogParams {
|
||||
accountId: string;
|
||||
accounts: Account[];
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { Currency, DataSource } from '.prisma/client';
|
||||
|
||||
export interface Order {
|
||||
accountId: string;
|
||||
currency: string;
|
||||
currency: Currency;
|
||||
dataSource: DataSource;
|
||||
date: Date;
|
||||
fee: number;
|
||||
id: string;
|
||||
|
@ -125,6 +125,7 @@ export class TransactionsPageComponent implements OnInit {
|
||||
public openUpdateTransactionDialog({
|
||||
accountId,
|
||||
currency,
|
||||
dataSource,
|
||||
date,
|
||||
fee,
|
||||
id,
|
||||
@ -140,6 +141,7 @@ export class TransactionsPageComponent implements OnInit {
|
||||
transaction: {
|
||||
accountId,
|
||||
currency,
|
||||
dataSource,
|
||||
date,
|
||||
fee,
|
||||
id,
|
||||
@ -177,9 +179,9 @@ export class TransactionsPageComponent implements OnInit {
|
||||
private openCreateTransactionDialog(): void {
|
||||
const dialogRef = this.dialog.open(CreateOrUpdateTransactionDialog, {
|
||||
data: {
|
||||
accounts: this.user.accounts,
|
||||
accounts: this.user?.accounts,
|
||||
transaction: {
|
||||
accountId: this.user.accounts.find((account) => {
|
||||
accountId: this.user?.accounts.find((account) => {
|
||||
return account.isDefault;
|
||||
})?.id,
|
||||
currency: null,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"background_color": "transparent",
|
||||
"categories": ["finance", "utilities"],
|
||||
"description": "Privacy-first Portfolio Tracker",
|
||||
"description": "Open Source Portfolio Tracker",
|
||||
"display": "standalone",
|
||||
"icons": [
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Ghostfolio – Privacy-first Portfolio Tracker</title>
|
||||
<title>Ghostfolio – Open Source Portfolio Tracker</title>
|
||||
<base href="/" />
|
||||
<meta charset="utf-8" />
|
||||
<meta content="yes" name="apple-mobile-web-app-capable" />
|
||||
@ -25,13 +25,13 @@
|
||||
/>
|
||||
<meta
|
||||
name="twitter:title"
|
||||
content="Ghostfolio – Privacy-first Portfolio Tracker"
|
||||
content="Ghostfolio – Open Source Portfolio Tracker"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta property="og:description" content="" />
|
||||
<meta
|
||||
property="og:title"
|
||||
content="Ghostfolio – Privacy-first Portfolio Tracker"
|
||||
content="Ghostfolio – Open Source Portfolio Tracker"
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://www.ghostfol.io" />
|
||||
@ -42,7 +42,7 @@
|
||||
<meta property="og:updated_time" content="2021-03-20T00:00:00+00:00" />
|
||||
<meta
|
||||
property="og:site_name"
|
||||
content="Ghostfolio – Privacy-first Portfolio Tracker"
|
||||
content="Ghostfolio – Open Source Portfolio Tracker"
|
||||
/>
|
||||
|
||||
<link
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ghostfolio",
|
||||
"version": "0.93.0",
|
||||
"version": "0.96.0",
|
||||
"homepage": "https://ghostfol.io",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
|
@ -59,22 +59,23 @@ model MarketData {
|
||||
}
|
||||
|
||||
model Order {
|
||||
Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId])
|
||||
Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId])
|
||||
accountId String?
|
||||
accountUserId String?
|
||||
createdAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
currency Currency
|
||||
dataSource DataSource @default(YAHOO)
|
||||
date DateTime
|
||||
fee Float
|
||||
id String @default(uuid())
|
||||
Platform Platform? @relation(fields: [platformId], references: [id])
|
||||
id String @default(uuid())
|
||||
Platform Platform? @relation(fields: [platformId], references: [id])
|
||||
platformId String?
|
||||
quantity Float
|
||||
symbol String
|
||||
type Type
|
||||
unitPrice Float
|
||||
updatedAt DateTime @updatedAt
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
updatedAt DateTime @updatedAt
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
|
||||
@@id([id, userId])
|
||||
@ -128,6 +129,12 @@ enum Currency {
|
||||
USD
|
||||
}
|
||||
|
||||
enum DataSource {
|
||||
GHOSTFOLIO
|
||||
RAKUTEN
|
||||
YAHOO
|
||||
}
|
||||
|
||||
enum Provider {
|
||||
ANONYMOUS
|
||||
GOOGLE
|
||||
|
Reference in New Issue
Block a user