mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Invert the F::Q price if there's already one in the other direction.
We don't want to create prices in both directions on the same day.
This commit is contained in:
parent
890cfe2186
commit
157c7e30a5
@ -1,17 +1,17 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; price-quotes.scm - manage sub-processes.
|
;;; price-quotes.scm - manage sub-processes.
|
||||||
;;; Copyright 2001 Rob Browning <rlb@cs.utexas.edu>
|
;;; Copyright 2001 Rob Browning <rlb@cs.utexas.edu>
|
||||||
;;;
|
;;;
|
||||||
;;; This program is free software; you can redistribute it and/or
|
;;; This program is free software; you can redistribute it and/or
|
||||||
;;; modify it under the terms of the GNU General Public License as
|
;;; modify it under the terms of the GNU General Public License as
|
||||||
;;; published by the Free Software Foundation; either version 2 of
|
;;; published by the Free Software Foundation; either version 2 of
|
||||||
;;; the License, or (at your option) any later version.
|
;;; the License, or (at your option) any later version.
|
||||||
;;;
|
;;;
|
||||||
;;; This program is distributed in the hope that it will be useful,
|
;;; This program is distributed in the hope that it will be useful,
|
||||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;;; GNU General Public License for more details.
|
;;; GNU General Public License for more details.
|
||||||
;;;
|
;;;
|
||||||
;;; You should have received a copy of the GNU General Public License
|
;;; You should have received a copy of the GNU General Public License
|
||||||
;;; along with this program; if not, contact:
|
;;; along with this program; if not, contact:
|
||||||
;;;
|
;;;
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
(define (item-list->hash! lst hash
|
(define (item-list->hash! lst hash
|
||||||
getkey getval
|
getkey getval
|
||||||
hashref hashset
|
hashref hashset
|
||||||
list-duplicates?)
|
list-duplicates?)
|
||||||
;; Takes a list of the form (item item item item) and returns a hash
|
;; Takes a list of the form (item item item item) and returns a hash
|
||||||
;; formed by traversing the list, and getting the key and val from
|
;; formed by traversing the list, and getting the key and val from
|
||||||
@ -58,7 +58,7 @@
|
|||||||
(if existing-val
|
(if existing-val
|
||||||
(hashset hash key (cons val existing-val))
|
(hashset hash key (cons val existing-val))
|
||||||
(hashset hash key (list val))))))
|
(hashset hash key (list val))))))
|
||||||
|
|
||||||
(for-each handle-item lst)
|
(for-each handle-item lst)
|
||||||
hash)
|
hash)
|
||||||
|
|
||||||
@ -205,7 +205,7 @@
|
|||||||
;; a list of the corresponding commodities. Also perform a bit of
|
;; a list of the corresponding commodities. Also perform a bit of
|
||||||
;; optimization, merging calls for symbols to the same
|
;; optimization, merging calls for symbols to the same
|
||||||
;; Finance::Quote method.
|
;; Finance::Quote method.
|
||||||
;;
|
;;
|
||||||
;; Returns a list of the info needed for a set of calls to
|
;; Returns a list of the info needed for a set of calls to
|
||||||
;; gnc-fq-helper. Each item will of the list will be of the
|
;; gnc-fq-helper. Each item will of the list will be of the
|
||||||
;; form:
|
;; form:
|
||||||
@ -223,7 +223,7 @@
|
|||||||
(commodity-list #f)
|
(commodity-list #f)
|
||||||
(currency-list (filter
|
(currency-list (filter
|
||||||
(lambda (a) (not (gnc-commodity-equiv (cadr a) (caddr a))))
|
(lambda (a) (not (gnc-commodity-equiv (cadr a) (caddr a))))
|
||||||
(call-with-values
|
(call-with-values
|
||||||
(lambda () (partition!
|
(lambda () (partition!
|
||||||
(lambda (cmd)
|
(lambda (cmd)
|
||||||
(not (string=? (car cmd) "currency")))
|
(not (string=? (car cmd) "currency")))
|
||||||
@ -257,7 +257,7 @@
|
|||||||
;;
|
;;
|
||||||
;; ("yahoo" (commodity-1 currency-1 tz-1)
|
;; ("yahoo" (commodity-1 currency-1 tz-1)
|
||||||
;; (commodity-2 currency-2 tz-2) ...)
|
;; (commodity-2 currency-2 tz-2) ...)
|
||||||
;;
|
;;
|
||||||
;; ("yahoo" "IBM" "AMD" ...)
|
;; ("yahoo" "IBM" "AMD" ...)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -411,6 +411,12 @@
|
|||||||
(set! saved-price (gnc-pricedb-lookup-day pricedb
|
(set! saved-price (gnc-pricedb-lookup-day pricedb
|
||||||
commodity currency
|
commodity currency
|
||||||
gnc-time))
|
gnc-time))
|
||||||
|
(if (null? saved-price)
|
||||||
|
(begin
|
||||||
|
(set! saved-price (gnc-pricedb-lookup-day pricedb currency
|
||||||
|
commodity gnc-time))
|
||||||
|
(if (not (null? saved-price))
|
||||||
|
(set! price (gnc-numeric-invert(price))))))
|
||||||
(if (not (null? saved-price))
|
(if (not (null? saved-price))
|
||||||
(begin
|
(begin
|
||||||
(gnc-price-begin-edit saved-price)
|
(gnc-price-begin-edit saved-price)
|
||||||
|
Loading…
Reference in New Issue
Block a user